dzt/shopify-monitor

ReferenceError: stock is not defined

Opened this issue · 3 comments

Getting this error on startup, no matter whether using Discord or Slack:

Discord:

ReferenceError: stock is not defined
at DiscordWebhook.myWebhook.on (/home/ubuntu/shopify-monitor/src/classes/Notify.js:55:15)
at DiscordWebhook.emit (events.js:180:13)
at Request.DiscordWebhook.request [as _callback] (/home/ubuntu/shopify-monitor/node_modules/discord-webhooks/index.js:33:12)
at Request.self.callback (/home/ubuntu/shopify-monitor/node_modules/request/request.js:186:22)
at Request.emit (events.js:180:13)
at Request. (/home/ubuntu/shopify-monitor/node_modules/request/request.js:1163:10)
at Request.emit (events.js:180:13)
at IncomingMessage. (/home/ubuntu/shopify-monitor/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:272:13)
at IncomingMessage.emit (events.js:185:15)
at endReadableNT (_stream_readable.js:1106:12)
at process._tickCallback (internal/process/next_tick.js:178:19)
Emitted 'error' event at:
at Request.DiscordWebhook.request [as _callback] (/home/ubuntu/shopify-monitor/node_modules/discord-webhooks/index.js:35:12)
at Request.self.callback (/home/ubuntu/shopify-monitor/node_modules/request/request.js:186:22)
[... lines matching original stack trace ...]
at process._tickCallback (internal/process/next_tick.js:178:19)


screen shot 2018-04-28 at 2 28 45 pm

Slack:

[Sat Apr 28 2018 18:34:33] [LOG] [undefeated.com]: Restock/Price Change: https://undefeated.com/products/kamanda-cblack-gum3
/home/ubuntu/shopify-monitor/src/classes/Notify.js:109
"value": stock,
^

ReferenceError: stock is not defined
at Object.Notify.slack (/home/ubuntu/shopify-monitor/src/classes/Notify.js:109:16)
at Shopify.getStockData (/home/ubuntu/shopify-monitor/src/classes/Task.js:213:26)
at Request._callback (/home/ubuntu/shopify-monitor/src/classes/Shopify.js:215:12)
at Request.self.callback (/home/ubuntu/shopify-monitor/node_modules/request/request.js:186:22)
at Request.emit (events.js:180:13)
at Request. (/home/ubuntu/shopify-monitor/node_modules/request/request.js:1163:10)
at Request.emit (events.js:180:13)
at IncomingMessage. (/home/ubuntu/shopify-monitor/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:272:13)
at IncomingMessage.emit (events.js:185:15)
at endReadableNT (_stream_readable.js:1106:12)
at process._tickCallback (internal/process/next_tick.js:178:19)

Running Ubuntu 16.04 LTS, starting server with node server command.

did u ever find a solution, or is iy down

None, happens on Windows as well.

This has stabilized things for me, I assume I'll lose any stock counts sent to the webhooks, unsure of any other ill effects, but the crashes have stopped and updates are being sent to my discord server

https://gist.github.com/vanhoof/0d98d50a17a9c4c1c3df11487c70f259