R
Railway4mo ago
Nate

Next.js InvalidUrl error when I change the domain name

npm ERR! path /app

npm ERR! command failed

npm ERR! signal SIGTERM

npm ERR! command sh -c next start



npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-08-02T23_21_13_903Z-debug-0.log

TypeError [ERR_INVALID_URL]: Invalid URL

at new NodeError (node:internal/errors:405:5)

at new URL (node:internal/url:676:13)

at iX (/app/.next/server/chunks/361.js:393:47593)

at i2 (/app/.next/server/chunks/361.js:393:53647)

at /app/.next/server/chunks/361.js:393:54657

at h (/app/.next/server/app/page.js:1:14082)

at eh (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:134786)

at e (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:137671)

at ek (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:138145)

at Array.toJSON (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:135755) {

input: 'streaksaver.up.railway.app',

code: 'ERR_INVALID_URL',

digest: '3650051894'

}
npm ERR! path /app

npm ERR! command failed

npm ERR! signal SIGTERM

npm ERR! command sh -c next start



npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-08-02T23_21_13_903Z-debug-0.log

TypeError [ERR_INVALID_URL]: Invalid URL

at new NodeError (node:internal/errors:405:5)

at new URL (node:internal/url:676:13)

at iX (/app/.next/server/chunks/361.js:393:47593)

at i2 (/app/.next/server/chunks/361.js:393:53647)

at /app/.next/server/chunks/361.js:393:54657

at h (/app/.next/server/app/page.js:1:14082)

at eh (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:134786)

at e (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:137671)

at ek (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:138145)

at Array.toJSON (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:135755) {

input: 'streaksaver.up.railway.app',

code: 'ERR_INVALID_URL',

digest: '3650051894'

}
I am getting this error when I changed the railway deployment url. Not sure whats causing it. I'm using Next.js v14
Solution:
New reply sent from Help Station thread:
Yep. That worked (changing NEXTAUTH_URL to AUTH_URL)
You're seeing this because this thread has been automatically linked to the Help Station thread....
Jump to solution
5 Replies
Percy
Percy4mo ago
Project ID: 808d69ee-f688-4ec9-b90d-0be6af1aa4a0
Nate
NateOP4mo ago
808d69ee-f688-4ec9-b90d-0be6af1aa4a0
Brody
Brody4mo ago
have you re-deployed since?
Nate
NateOP4mo ago
Yep i redeployed. Im testing right now to see if it was because there was no https:// in front of my shared variable for the public url Seems to have kind of fixed it. This is only semi-related to railway now Basically I'm using next-auth and when node.js ran new URL ( public endpoint) without the https:// in front, it errored out. I added it and now I'm getting a weird error with nextauth.
[auth][error] UntrustedHost: Host must be trusted. URL was: https://streaksaver.up.railway.app/api/auth/providers. Read more at https://errors.authjs.dev#untrustedhost

at /app/.next/server/chunks/361.js:393:48353

at iZ (/app/.next/server/chunks/361.js:393:51024)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

at async /app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:36258

at async eR.execute (/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:26874)

at async eR.handle (/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:37512)

at async doRender (/app/node_modules/next/dist/server/base-server.js:1377:42)

at async cacheEntry.responseCache.get.routeKind (/app/node_modules/next/dist/server/base-server.js:1599:28)
[auth][error] UntrustedHost: Host must be trusted. URL was: https://streaksaver.up.railway.app/api/auth/providers. Read more at https://errors.authjs.dev#untrustedhost

at /app/.next/server/chunks/361.js:393:48353

at iZ (/app/.next/server/chunks/361.js:393:51024)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

at async /app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:36258

at async eR.execute (/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:26874)

at async eR.handle (/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:37512)

at async doRender (/app/node_modules/next/dist/server/base-server.js:1377:42)

at async cacheEntry.responseCache.get.routeKind (/app/node_modules/next/dist/server/base-server.js:1599:28)
redeploying to see if that has any effect I'm changing the .env var from "NEXTAUTH_URL" to "AUTH_URL" to see if that fixes. It seems its now using a different version of Auth.js or nextauth
Solution
Duchess
Duchess4mo ago
New reply sent from Help Station thread:
Yep. That worked (changing NEXTAUTH_URL to AUTH_URL)
You're seeing this because this thread has been automatically linked to the Help Station thread.
Want results from more Discord servers?
Add your server