Deployment failing with node and auth.js

I am building a quiz app which utilizes auth.js for authentication. In development when I click run we use vite to preview the website and it works fine, however when we deploy to production I dont think I can use vite so I tried using the built in node server with the node adapter on sveltekit.
So to deploy my replit im doing this

~/Globe-Quiz-Frontend/skeleton-app$ PORT=80 node -r dotenv/config build
Listening on
[auth][error][UntrustedHost]: Host must be trusted. URL was: globe-quiz-frontend--dev144.repl.c o/auth/session. Read more at errors.authjs#untrustedhost

If you do some googling you can figure out that NEXTAUTH_URLmust be set correctly to avoid this error but when I set it to globe-quiz-frontend–dev144.repl or repl I still get the same error.

When defining NEXTAUTH_URL the environment variable must reflect the full URL where your application is hosted in production. If your application is hosted at , then NEXTAUTH_URL should be set to this exact URL.

Also check if the auth.js configuration is properly set up for production, specially the providers and callbacks sections where the host and URLs might need to be validated.

1 Like

I was able to get it to deploy without erroring out by basically disabling the check by setting the env variable AUTH_TRUST_HOST. Idk what was wrong with my conf before but its working so I wont question it. I got that from a github issue someone posted when deploying with cloudflare.

This issue is now im trying to link my domain with namecheap and im getting this ssl error: ERR_SSL_PROTOCOL_ERROR
My namecheap config matches what replit told me in the link domain section…

Do you have any idea what I may be doing wrong?