Routing data from NoteHub to Sparrow reference web app

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.

If you need more info, let me know.

Thank you!

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

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

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

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.

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, and then re-route older events from Notehub 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

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

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


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

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.

TJ

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:

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

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

This is the error I am getting:

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.

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.

@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 We’ll reach out when it’s merged so you can try it out.

TJ

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