Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node:internal/process/promises:288 #9

Open
kilik128 opened this issue Jul 29, 2023 · 1 comment
Open

node:internal/process/promises:288 #9

kilik128 opened this issue Jul 29, 2023 · 1 comment

Comments

@kilik128
Copy link

kilik128 commented Jul 29, 2023

got this
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#".] {
code: 'ERR_UNHANDLED_REJECTION'
}

after check

// Generate image from prompt only
let image1 = await WomboDream.generateImage(1, "dog", token).catch((error) => {
// Handle the error here
console.error("Error occurred:", error);
});

it's
Error occurred: { detail: 'Invalid token' }

maybie just miss somethinks not sure like Bearer on token, ?

@cdgco
Copy link
Owner

cdgco commented Jul 29, 2023

The UnhandledPromiseRejection is because I wasn't handling nested promise rejections in generateImage(), but that's resolved now in d43195a which I'll publish in v2.0.1. No need to add .catch() to generateImage (also if you're using the await style syntax, you would want to do a try / catch instead of .catch() anyway).

The actual error from Wombo Dream is Invalid token though, which means your API key was rejected. You shouldn't need to add Bearer or anything, the authentication should all be handled internally (bearer is already added in defineHeaders() in dream.js). Just make sure that you are setting the variable token to your API key before generateImage() like const token = "API-KEY".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants