midjourney-api icon indicating copy to clipboard operation
midjourney-api copied to clipboard

Initializing a client fails

Open alchaplinsky opened this issue 1 year ago • 9 comments

the code that reproduces this issue or a replay of the bug

const DISCORD_SERVER_ID = 1133306614422708234;
const DISCORD_CHANNEL_ID = 1133306615282548788;
const DISCORD_TOKEN =  "<TOKEN>";

let { Midjourney } = require("midjourney");

let client = new Midjourney({
  ServerId: DISCORD_SERVER_ID,
  ChannelId: DISCORD_CHANNEL_ID,
  SalaiToken: DISCORD_TOKEN,
  Debug: true,
});

await client.init();

Describe the bug

Describe the bug Following the README in this repo. Created a server and invited Midjourney bot to it. Assigned DISCORD_SERVER_ID, DISCORD_CHANNEL_ID, DISCORD_TOKEN variables and tried to call await client.init().

Expected behavior Client initialization should be successful.

error log

Uncaught Error: Failed to get application_commands for command settings
    at MidjourneyApi.getCommand (/Users/alex/Projects/assistant/node_modules/midjourney/libs/command.js:82:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Midjourney.Connect (/Users/alex/Projects/assistant/node_modules/midjourney/libs/midjourney.js:32:13)
    at async Midjourney.init (/Users/alex/Projects/assistant/node_modules/midjourney/libs/midjourney.js:44:9)
    at async REPL12:1:33

alchaplinsky avatar Jul 25 '23 08:07 alchaplinsky

got the same error here when using imagine api - api is very unusable now. Hopefully we can escalate this issue thanks!

bingyuyap avatar Jul 28 '23 04:07 bingyuyap

got the same error

6leonardo avatar Jul 30 '23 07:07 6leonardo

Experiencing the same error.

Sikandarkhan avatar Aug 01 '23 02:08 Sikandarkhan

found the reason - likely salai token is invalid. Try using a new salai token

bingyuyap avatar Aug 01 '23 02:08 bingyuyap

Becareful guys, ServerId and ChannelId should be passed as string or they will be automatically rounded down by JS.

manhhailua avatar Aug 08 '23 15:08 manhhailua

@bingyuyap Good call!

WhaSukGO avatar Sep 11 '23 16:09 WhaSukGO

I encountered the same error. Despite logging out and back into Discord, and updating the Discord token, the issue persists without any success.

fberbert avatar Feb 23 '24 00:02 fberbert

same error here

Soundpulse avatar Feb 23 '24 08:02 Soundpulse

try this fix. it's working for me - https://github.com/erictik/midjourney-api/pull/256/files

NatalieM11 avatar Feb 23 '24 14:02 NatalieM11