vercel / platforms

A full-stack Next.js app with multi-tenancy and custom domain support. Built with Next.js App Router and the Vercel Domains API.
https://app.vercel.pub
5.62k stars 735 forks source link

Auth SSL Error when Guide is followed #293

Open claytonrothschild opened 1 year ago

claytonrothschild commented 1 year ago

Hi, cool project.

An https error occurs when logging in if one follows the guide. Here is the context and solution:

In step 2 of https://vercel.com/guides/nextjs-multi-tenant-application, it says you can pull the env vars with the Vercel CLI by running vc env pull.

If you do this, it will setup a .env.local and .env.development file.

In these files, a property is set, VERCEL="1"

If VERCEL="1" in env.development, and you run locally, then it will automatically upgrade the connection of whatever URL is set in NEXTAUTH_URL.

So, if you have NEXTAUTH_URL="http://app.localhost:3000", then when you goto http://app.localhost:3000/login, and click the login button, it will automatically upgrade http://app.localhost:3000 to https://app.localhost:3000, which results in an https error.

The solution was to set VERCEL="" in .env.development. Then I was able to progress with the repo.

Thank you

simaofreitas commented 10 months ago

This worked! Should be part of the regular docs. Thanks a lot @claytonrothschild