Back

Issue with 'Failed to construct 'URL': Invalid URL' after moving to production

  • 0
  • General
  • Auth
  • Cloud
larkx
23 Apr, 2024, 09:06

Hi, I recently deployed my app into production but have discovered an issue. When I try and login, I just get the error Failed to construct 'URL': Invalid URL.

Now, I've created the platform and have set the hostname to be that of the production URL. Furthermore, I realised that my .env.local file which contains the api route, project Id, database Ids and collection Ids was not on production. So, I added the values to Vercel but I'm still getting the same error.

Any ideas?

Here's the variables and how I'm accessing them in my code:

Thank you!

TL;DR
Issue: 'Failed to construct 'URL': Invalid URL' error after moving app to production. Resolution: The error is likely due to misconfiguration of the URLs in the production environment. Ensure that the necessary environment variables are correctly set in the production environment (e.g., API route, project Id, database Ids, collection Ids). Double-check the URLs and configurations to make sure they are pointing to the correct locations in the production environment.
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