I required using dotenv-cli package to wrap the execution of node handle-commands.js to populate environment variables correctly. I imagine this is due to my WSL install.
This is easily accomplished via npm i dotenv-cli -g, then running the command listed below.
PROBLEM
dotenv node handle-commands.js fails
CRASH DUMP
jason@pc2strong:~/discord-bot/go-offline$ dotenv node deploy-commands.js
Started refreshing application (/) commands.
DiscordAPIError[50035]: Invalid Form Body
application_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
at handleErrors (/home/jason/discord-bot/go-offline/node_modules/@discordjs/rest/dist/index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/jason/discord-bot/go-offline/node_modules/@discordjs/rest/dist/index.js:1021:23)
at async SequentialHandler.queueRequest (/home/jason/discord-bot/go-offline/node_modules/@discordjs/rest/dist/index.js:862:14)
at async REST.request (/home/jason/discord-bot/go-offline/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async /home/jason/discord-bot/go-offline/deploy-commands.js:39:9 {
requestBody: { files: undefined, json: [ [Object], [Object], [Object] ] },
rawError: {
code: 50035,
errors: { application_id: [Object] },
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'PUT',
url: 'https://discord.com/api/v9/applications/undefined/commands'
}
POSSIBLE SOLUTION
Upgrade handle-commands.js to new Slash Command Registration system.
VERSIONS
node
: 18.15.1ADDED STEPS
I required using
dotenv-cli
package to wrap the execution ofnode handle-commands.js
to populate environment variables correctly. I imagine this is due to my WSL install.PROBLEM
dotenv node handle-commands.js
failsCRASH DUMP
POSSIBLE SOLUTION
Upgrade
handle-commands.js
to new Slash Command Registration system.Thank you!