[Bug]: Couldn't send discord message: "Message content must be a non-empty string"
twity1337 opened this issue · comments
Expected Behavior
A discord notification is expected.
Current Behavior
When I try to set up discord notifications with streetmerchant, I receive the following error on Stock-Alarms.
Even testing the Notifications with the following Docker command shows the same exception message:
docker run -it --rm \
--env-file ./dotenv \
ghcr.io/jef/streetmerchant:nightly test:notification:production
What operating system are you seeing the problem on?
Linux
Relevant log output
This is the stack trace that I receive on stock alarms:
error :: ✖ couldn't send discord message Message content must be a non-empty string. {
streetmerchant | "stack": "RangeError [MESSAGE_CONTENT_TYPE]: Message content must be a non-empty string.
at Function.verifyString (/app/node_modules/discord.js/src/util/Util.js:414:49)
at MessagePayload.makeContent (/app/node_modules/discord.js/src/structures/MessagePayload.js:113:22)
at MessagePayload.resolveData (/app/node_modules/discord.js/src/structures/MessagePayload.js:128:26)
at WebhookClient.send (/app/node_modules/discord.js/src/structures/Webhook.js:165:61)
at /app/build/src/messaging/discord.js:58:30
at new Promise (<anonymous>)
at /app/build/src/messaging/discord.js:56:35
at Object.sendDiscordMessage (/app/build/src/messaging/discord.js:76:11)
at Object.sendNotification (/app/build/src/messaging/notification.js:27:15)
at lookupIem (/app/build/src/store/lookup.js:260:21)"
Configuration
ASCII_BANNER=false
ASCII_COLOR=true
AUTO_ADD_TO_CART=false
BROWSER_TRUSTED=true
DISCORD_NOTIFY_GROUP=
DISCORD_NOTIFY_GROUP_SONYPS5C=
DISCORD_NOTIFY_GROUP_SONYPS5DE=
DISCORD_WEB_HOOK=https://discord.com/api/webhooks/000000000000000000/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
HEADLESS=true
IN_STOCK_WAIT_TIME=30
INCOGNITO=
LOG_LEVEL=
LOW_BANDWIDTH=true
MAX_PRICE_SERIES_SONYPS5C=700
MAX_PRICE_SERIES_SONYPS5DE=
OPEN_BROWSER=false
PAGE_BACKOFF_MIN=
PAGE_BACKOFF_MAX=
PAGE_SLEEP_MIN=120000
PAGE_SLEEP_MAX=180000
PAGE_TIMEOUT=
PLAY_SOUND=false
RESTART_TIME=
SCREENSHOT=
SHOW_ONLY_BRANDS=
SHOW_ONLY_MODELS=ps5 console
SHOW_ONLY_SERIES=sonyps5c
STORES=alternate-de,amazon-de,gamestop-de,mediamarkt,saturn,medimax,otto,spielegrotte
Code of Conduct
- I agree to follow this project's Code of Conduct
I had a look into this and found out, that it can be solved by setting a group text (any string in DISCORD_NOTIFY_GROUP
). So this seems to be a Workaround.
I just fixed this by setting a space as content, if no group has been provided. I'm going to submit a PR soon.
EDIT: Ahh, I just saw the mentioning 😅 Well, then my PR is not needed, good!
Good find. Thank you!
Fixed in #2714