Back

[SOLVED] Create verification email error

  • 0
  • Accounts
  • Web
  • Cloud
omzi
1 Sep, 2023, 03:25

πŸ‘‹ Good day, Appwrite staff. I'm trying to create a verification email to test out my auth workflow locally. Initially, I got this error:

TypeScript
Invalid url: URL host must be one of: localhost, cloud.appwrite.io, 127.0.0.1

I thought it had something to do with port numbers. I then setup a proxy server with Nginx locally and tried again. I got the same error ;(:

TypeScript
Invalid url: URL host must be one of: localhost, cloud.appwrite.io, local.dev

Here's my code handling it: (Next.js)

TypeScript
await AppwriteService.signup(email, password);
toast.success('Account created successfully!', toastOptions);

// First login, then send verification email
await AppwriteService.login(email, password);
await AppwriteService.sendVerificationEmail(`${config.HOST}/auth/confirm-account`);
      
// Redirect to the /verify-account page
router.push('/auth/verify-account');

The value of config.HOST is local.dev.

And yes, I've set up a custom domain. Is there any other thing I'm missing? I'd really appreciate a nudge in the right direction as this error is driving me crazy.

TL;DR
Title: [SOLVED] Verification email error with local.dev domain - Initially received the error "Invalid url: URL host must be one of: localhost, cloud.appwrite.io, 127.0.0.1" - Tried using a proxy server with Nginx but still received the error - Fixed the issue by adding "local.dev" as a web platform to the project - Solution: Add "local.dev" as a web platform to the project by following the instructions in this link: <https://appwrite.io/docs/getting-started-for-web#addPlatform>
Drake
1 Sep, 2023, 03:41

local.dev is not in this list: localhost, cloud.appwrite.io, 127.0.0.1. You have to add local.dev as a web platform to your project.

See https://appwrite.io/docs/getting-started-for-web#addPlatform

omzi
1 Sep, 2023, 14:41

I think you missed the part where I mentioned I was initially using 127.0.0.1. After I switched to local.dev, I updated my platform host to local.dev.

Drake
1 Sep, 2023, 15:08

so is it working now? what error are you getting now?

omzi
2 Sep, 2023, 15:20

Pardon my late reply ;). It's not working. I tried again today.

omzi
2 Sep, 2023, 15:33

I've figured a temporary workaround (pending when I get a fix): I use the secret returned from the createVerification() method and manually verify the user.

EDIT: It works now πŸ‘€. Turns out I needed to add the protocol in front of the URL. My bad.

Drake
2 Sep, 2023, 18:10

[SOLVED] Create verification email error

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more