ReferenceError: Buffer is not defined

As off today, a script that has always worked, now suddenly throws an error …
:x: Script Error

:warning: ReferenceError: Buffer is not defined
at connectToWallbox (wallbox.js:25:35)
at wallbox.js:131:19
at processTicksAndRejections (node:internal/process/task_queues:96:5)

I am running Homey 7.4.1 and HomeyScript v3.3.0.
Restarted HomeyScript and also have restarted Homey. No change.
No other installs etc done.

I think it helps when you share the script with us?

I don’t see why. Buffer is a global variable set by homeyscript. Now it is not defined anymore. Why do you need the script?
If you think it’might help, but I don’t see how : Wallbox Pulsar plus charger lock/unlock pause/resume

I’m not sure how your script ever worked because nothing has been updated that could cause your issue as far as I can see. However you can update your script to at least work again with this:

const Buffer = this.constructor.constructor("return Buffer")()
console.log(Buffer.from('test'));

I disagree:
3.2.6
14 okt. 2021
Added Buffer to global scope.

You are right I could not see this in the source. I think there has been a publish of the app without the source being saved. Meaning the next version does not have the Buffer change with it.

2 Likes

That was quick! Buffer is back, thanks!

1 Like