erictik / midjourney-api

MidJourney client. Unofficial Node.js client
Apache License 2.0
1.67k stars 278 forks source link

example with websocket cannot run twice #117

Open davyzhang opened 1 year ago

davyzhang commented 1 year ago

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

npx tsx example/imagine-ws.ts

npx tsx example/imagine-ws.ts

Describe the bug

run this example 2 times, the second time it will raise an error and exit.

error log

midjourney-api/src/ws.message.ts:113 if (embeds[0].title.includes("continue")) { ^

TypeError: Cannot read properties of undefined (reading 'includes')

I debugged the embeds[0], it doesn't have title the second time

image
zcpua commented 1 year ago

thanks https://github.com/erictik/midjourney-api/commit/208bb96ace1180604e05520e68ebe4adef3b35c7