NextJS app not using my netlify assigned domain - redirects are ported to 80 on the original (random assigned) name for the site


I am using NextJS with Supabase, however when trying to login at /login, the page is directed to the initial project url:

I am also getting 501 error on the homepage, which is designed to redirect to /login when a user isn’t signed in, or to instead load the page contents when they are:

Aug 30, 08:17:29 PM: 0d36e402 ERROR  Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './server.edge' is not defined by "exports" in /var/task/node_modules/react-dom/package.json
    at new NodeError (node:internal/errors:405:5)
    at exportsNotFound (node:internal/modules/esm/resolve:364:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:700:9)
    at resolveExports (node:internal/modules/cjs/loader:567:36)
    at Module._findPath (node:internal/modules/cjs/loader:636:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
    at /var/task/.netlify/functions-internal/___netlify-handler/requireHooks.js:100:40
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18) {
}Aug 30, 08:17:29 PM: 0d36e402 INFO   [GET] / (SSR)Aug 30, 08:17:29 PM: 0d36e402 Duration: 22.16 ms	Memory Usage: 147 MB	Aug 30, 08:17:31 PM: 6a56b768 INFO   [GET] /favicon.ico (SSR)Aug 30, 08:17:31 PM: 6a56b768 Duration: 12.79 ms	Memory Usage: 147 MB	Aug 30, 08:17:35 PM: ac8a7ee2 INFO   [POST] /auth/sign-in (SSR)Aug 30, 08:17:35 PM: ac8a7ee2 Duration: 523.44 ms	Memory Usage: 147 MB	Aug 30, 08:17:36 PM: 57d18629 INFO   [POST] /auth/sign-in (SSR)Aug 30, 08:17:36 PM: 57d18629 Duration: 451.57 ms	Memory Usage: 147 MB	

Are there any configurations that I am missing? On redirect, I am using this:

return NextResponse.redirect(requestUrl.origin, {
    // a 301 status is required to redirect from a POST to a GET route
    status: 301,

Would really appreciate any help on this. Thanks.

1 Like

Well, let’s leave the origin problem for now, because you’re facing a bigger problem which doesn’t have a solution yet: