Next.js InvalidUrl error when I change the domain name

10 months ago

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

Solved

1 Replies

10 months ago

808d69ee-f688-4ec9-b90d-0be6af1aa4a0


10 months ago

have you re-deployed since?


10 months 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


10 months ago

Seems to have kind of fixed it. This is only semi-related to railway now


10 months ago

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)

10 months ago

redeploying to see if that has any effect


10 months ago

I'm changing the .env var from "NEXTAUTHURL" to "AUTHURL" to see if that fixes. It seems its now using a different version of Auth.js or nextauth


10 months ago

Yep. That worked (changing NEXTAUTH_URL to AUTH_URL)


Status changed to Solved brody 10 months ago