bisand / node-red-contrib-tibber-api

Node Red module for integrating with Tibber api
MIT License
20 stars 2 forks source link

Cannot create property 'httpCode' on string 'GraphQL queries must be strings.' #55

Closed cod3gen closed 1 year ago

cod3gen commented 2 years ago

Hi,

I am currently not able to fetch tibber data, returns following error:

29 Mar 18:24:00 - [red] Uncaught Exception:
29 Mar 18:24:00 - [error] TypeError: Cannot create property 'httpCode' on string 'GraphQL queries must be strings.'
    at IncomingMessage.<anonymous> (/config/node-red/node_modules/tibber-api/src/nodes/TibberQuery.ts:98:46)
    at IncomingMessage.emit (node:events:532:35)
    at endReadableNT (node:internal/streams/readable:1346:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

This is on Node-RED v11.1.1 @ HA Core 2022.3.8. Anyone know of a fix for this? :)

bisand commented 2 years ago

I will do some testing on my side to see if I can reproduce it. @cod3gen Can you please provide the content of the payload you are trying to inject, if any. Thanks!

cod3gen commented 2 years ago

I will do some testing on my side to see if I can reproduce it. @cod3gen Can you please provide the content of the payload you are trying to inject, if any. Thanks!

Thanks. cron-plus is serving pulses to fetch prices to pass on to power-saver. Tried to send cron-plus`s payload to both msg.payload and just msg.xx without any differences. tibber_query

bisand commented 2 years ago

I suspect that the cron-plus node is injecting an unsupported payload to the Tibber-Query. This node only support GraphQL queries in the payload like the following example:

{viewer{homes{id size appNickname appAvatar address{address1 address2 address3 postalCode city country latitude longitude}}}}

Try that and se if this solves the problem @cod3gen.

bisand commented 2 years ago

Hi, I have just updated to a new version with improve error handling that should give you a better error message in case this happens again. The new version is 2.6.2. Relates to #57

bisand commented 1 year ago

Should be resolved by now. Please report back if you still experience problems.