# Routing data from NoteHub to Sparrow reference web app

**URL:** <https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310>\
**Category:** Notehub.io\
**Created:** [March 7, 2023, 11:19pm UTC](https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310 "2023-03-07T23:19:33Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![sramesh6](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sramesh6](https://discuss.blues.com/u/sramesh6)\
**Post date:** [March 7, 2023, 11:19pm UTC](https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310/1 "2023-03-07T23:19:33Z")

</div>

Hello,

I am trying to route some data from NoteHub to the sparrow reference web app using the tutorial on the GitHub. I have done the tutorial and I am just trying to route some events to the web app, but when I try, I am getting an error during the routing.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/a28bde31517ac3806c15704cb9012c84c92f9c65.png)

If you need more info, let me know.

Thank you!

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [March 8, 2023, 3:58pm UTC](https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310/2 "2023-03-08T15:58:47Z")

</div>

Hey @sramesh6,

Welcome to the Blues community, and thanks for trying this project out!

If you have the web app running locally you should be getting a more complete error in your local environment. For me, I see stack traces in the VS Code terminal where I ran `yarn dev` to start up the web app.

Find one of those stack traces and it should give you a far better error that (hopefully) will point you at the issue. If you’re still stuck, feel free to post that stack trace here and we can help you figure out what’s up.

TJ

---

<div class="post-metadata">

**Author:** ![sramesh6](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sramesh6](https://discuss.blues.com/u/sramesh6)\
**Post date:** [March 9, 2023, 5:58pm UTC](https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310/3 "2023-03-09T17:58:57Z")

</div>

Hello,

Thank you for responding to me! I looked in my error log in VSCode, and this is the error I got:

Error loading event undefined. Cause: Error: device uid is not defined

I don’t see a field for this in the template given in the dev.db.persistent.sh file, so where do I define this?

Thank you

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [March 9, 2023, 10:02pm UTC](https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310/4 "2023-03-09T22:02:56Z")

</div>

Hmmm… that’s odd. You shouldn’t need to define a DeviceUID, as the app should register that device the first time it receives an event from it.

Can you verify that your Postgres database is up and running, and if it is, check if you have any devices registered? You can start up the database’s studio by running the repo’s `dev.db.manage.sh` script.

TJ

---

<div class="post-metadata">

**Author:** ![sramesh6](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sramesh6](https://discuss.blues.com/u/sramesh6)\
**Post date:** [March 29, 2023, 7:12pm UTC](https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310/5 "2023-03-29T19:12:33Z")

</div>

Hello,

I just got back to working on this project, and so I do have the gateway recognized along with the 2 reference sensors, which suggests that the devices should be registered, but it is still throwing out the “device uid is not defined” error. The database is up and running too.

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [April 3, 2023, 3:20pm UTC](https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310/6 "2023-04-03T15:20:39Z")

</div>

Hey @sramesh6,

Sorry for the delay here, but we think we’ve figured out the problem. First, can you confirm that you’re getting this issue when attempting a bulk import?

We found a problem with our event handling during those imports, and we’re looking into that now. Thanks for reporting this!

In the meantime though you might want to [set up a local route](https://github.com/blues/sparrow-reference-web-app#routing), and then [re-route older events from Notehub](https://dev.blues.io/notehub/notehub-walkthrough/#manually-routing-events) to your project. The ability to re route events is new in Notehub, and we find it easier to use than the bulk import from the web app.

TJ

---

<div class="post-metadata">

**Author:** ![sramesh6](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sramesh6](https://discuss.blues.com/u/sramesh6)\
**Post date:** [April 3, 2023, 4:14pm UTC](https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310/7 "2023-04-03T16:14:33Z")

</div>

I am getting this issue when I am doing bulk import.

Unrelated question, but for the routing, I see these following steps:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/3ae8db9abb97515ecd2e66545021f4c31ed842ca.png)  
Where can I find the pin and sensor ID’s in an event on Notehub? Also, what’s the way I can include multiple sensors to be included in this step?

Thanks,  
Sreedhar

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [April 4, 2023, 2:05pm UTC](https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310/8 "2023-04-04T14:05:29Z")

</div>

That section is optional, and its main purpose is to allow users to access a dashboard by scanning the QR code sticker that comes with each Notecard.

The idea is you could attach that sticker to your end product or sensor, have users scan the QR code, and have them go directly to your dashboard to view sensor data.

You can find the `pin` by scanning that sticker, as it will take you to `qrgo.org/id/[deviceUID]/[pin]`. And this section of the documentation shows how you can access a sensor node’s identifier: [What To Do With Sparrow Data - Blues Developers](https://dev.blues.io/sparrow/what-to-do-with-sparrow-data/#distinguishing-between-nodes).

TJ

---

<div class="post-metadata">

**Author:** ![sramesh6](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sramesh6](https://discuss.blues.com/u/sramesh6)\
**Post date:** [April 4, 2023, 4:23pm UTC](https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310/9 "2023-04-04T16:23:20Z")

</div>

Oh ok, thanks for the clarification. I am trying to see what is wrong with my routing, I followed the instructions and looked at my local postgres database, and I don’t see any data being stored in there. I’m looking at the troubleshooting section of the README file, and I don’t seem to be getting any of the issues suggested there. The only thing I can think of is my setup of the Postgres URL, which I have included below:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/87fcdf8ea3713a9ef90d94ca3e310fa9c83ea518.png)

The only thing I changed was the Postgres Password since the password in the .env\_example didn’t work.

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [April 4, 2023, 6:29pm UTC](https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310/10 "2023-04-04T18:29:16Z")

</div>

Hmmm that’s strange. Just to confirm, you have your app running locally with `yarn dev`, you have a tunnel set up to hit your local machine, and you have a route in Notehub set up to hit your local server at `/api/datastore/ingest`?

If you have all that in place, can you route an event and share what you’re seeing in your server log (the one running `yarn dev`) when the event hits `/api/datastore/ingest`? Hopefully there’s some message in there that points us in the right direction. It should definitely throw an error if it was unable to add anything to the database.

TJ

---

<div class="post-metadata">

**Author:** ![sramesh6](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sramesh6](https://discuss.blues.com/u/sramesh6)\
**Post date:** [April 4, 2023, 7:51pm UTC](https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310/11 "2023-04-04T19:51:11Z")

</div>

This is the error I am getting:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/2e4fb994aeb28d1053d39d9993bd1aa9a261d074.png)

So it seems like my projectUID is incorrect, but that cannot be because in the web app, I am able to see the gateway along with the 2 reference sensors connected to the gateway.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/19f87f0ac2efe635be560865603f74b24ba759bc.png)

I have checked my route and I did add “/api/datastore/ingest”, and I am running the tunnel, database, and yarn at the same time.

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [April 5, 2023, 4:01pm UTC](https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310/12 "2023-04-05T16:01:34Z")

</div>

@sramesh6 The fix we’re working on in this PR should address your problem: [bug: fix event ingestion and remove bulk import functionality by paigen11 · Pull Request #121 · blues/sparrow-reference-web-app · GitHub](https://github.com/blues/sparrow-reference-web-app/pull/121) We’ll reach out when it’s merged so you can try it out.

TJ

---

<div class="post-metadata">

**Author:** ![sramesh6](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sramesh6](https://discuss.blues.com/u/sramesh6)\
**Post date:** [April 5, 2023, 4:12pm UTC](https://discuss.blues.com/t/routing-data-from-notehub-to-sparrow-reference-web-app/1310/13 "2023-04-05T16:12:40Z")

</div>

Thanks TJ! I will be looking forward to the updated web app after the fixes have been made.
