question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getCachedState() returns null, failing the requests

See original GitHub issue

The below code fails for me with

Cannot read property 'modelid' of null

so it’s clear that the getCachedState() function returns null in my case.

This was at the very first setup. I don’t know which exact situation is needed to reproduce this, but I got this error as soon as the Hue API started working for me for the first time.

I hope this is enough indication for you to find the bug in the code. null errors should be simple enough to fix.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
benbuckschcommented, Aug 17, 2020

I have recent Hue bridge, IIRC late 2018. I think that’s version 2.

FYI, when I tested, it was blowing up only at this one spot. With the hacky patch, it worked as expected. I could enumerate lights and rooms, and switch them on and off. However, it’s possible that this does unnecessary work on startup.

I perfectly understand the need to test the fixes. If you need me to test something specific with master, I can do that. However, I’m currently only vacation, and otherwise have to run 2 companies, so I cannot guarantee it.

Re: axing axios (pun intended): Yay! Thanks!

(replying by email)

Am 17. August 2020 10:12:23 MESZ schrieb Peter Murray notifications@github.com:

Your fix that you suggest just pushes problems further down and other stuff will blow up later in use (I cannot see how we don’t get a cache loaded). The cache is a requirement to load the known configuration and to store things like the lights that are known so that various validations can be performed later, getting past this current check just stores up later failures that will happen if you call certain functions in the API.

This ticket was closed as I provided some changes to get feedback to narrow down as to the problem at hand. There was no response from that and those changes added that I asked for feedback on.

If I cannot reproduce an issue, I cannot test it. If I cannot reproduce and test it, I cannot release a fix to it that I am confident in it not impacting other users.

Signify has ended software updates for the v1 of the bridge, so the need for this check is goign to go away as people retire the older bridges, removing the divergence in the API parameters.

I am currently working on a 5.0 release of the library which is removing axios for a fetch based implementation (to better support browser use cases and remove some of the bloat and proxy support issues of axios).

– You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/peter-murray/node-hue-api/issues/172#issuecomment-674732094

– Sent from my cell phone. Please excuse the brevity.

0reactions
peter-murraycommented, Aug 17, 2020

Your fix that you suggest just pushes problems further down and other stuff will blow up later in use (I cannot see how we don’t get a cache loaded). The cache is a requirement to load the known configuration and to store things like the lights that are known so that various validations can be performed later, getting past this current check just stores up later failures that will happen if you call certain functions in the API.

This ticket was closed as I provided some changes to get feedback to narrow down as to the problem at hand. There was no response from that and those changes added that I asked for feedback on.

If I cannot reproduce an issue, I cannot test it. If I cannot reproduce and test it, I cannot release a fix to it that I am confident in it not impacting other users.

Signify has ended software updates for the v1 of the bridge, so the need for this check is goign to go away as people retire the older bridges, removing the divergence in the API parameters.

I am currently working on a 5.0 release of the library which is removing axios for a fetch based implementation (to better support browser use cases and remove some of the bloat and proxy support issues of axios).

Read more comments on GitHub >

github_iconTop Results From Across the Web

next-auth get request issue returns null - Stack Overflow
i'm having a problem when i request GET to my api it returns me unauthenticated even though im logged in. my api code...
Read more >
Request.form returns null value on live site but it gives ... - MSDN
this code is working fine on localhost but on live server Request.Form returns Null value my sample code is here kindly tell me...
Read more >
Handling a Null Response from an API
An API that returns a null response can result in some really strange errors. Learn how to handle a null in Fetch and...
Read more >
Null API Responses and HTTP 204 Results in ASP.NET Core
ASP.NET Core 3.x has a behavior that results in API results that return null from the controller action returning a HTTP 204 -...
Read more >
c# - What's wrong with returning null?
I often see code which fails with NPE when it checks something.isEmpty() , thinking that something is an Optional. And then you get...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found