Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next Auth is throwing TypeError Invalid URL at build time in the gitlab pipelines right after => info - Collecting page data... #6479

Closed
netdesignr opened this issue Jan 23, 2023 · 3 comments
Labels
incomplete Insufficient reproduction. Without more info, we won't take further actions/provide help. triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@netdesignr
Copy link

Environment

System:
OS: macOS 12.6
CPU: (8) x64 Apple M1
Memory: 86.33 MB / 16.00 GB
Shell: 3.2.57 - /bin/sh

Binaries:
Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm

npmPackages:
next: ^11.1.0 => 11.1.0
next-auth: 4.5.0 => 4.5.0
react: ^17.0.2 => 17.0.2

Reproduction URL

https://unavailable.com

Describe the issue

Hi,

I wonder if anyone ever get this error:
javascript TypeError [ERR_INVALID_URL]: Invalid URL

I've started seeing this after I've upgraded NextAuth to v4 due to issues around cookie size limit. In version 4 there's cookie chunk implementation which is great. The issue now is that although everything works fine on local env in the Gitlab pipeline it fails right before providing the page reports and finalising the build.

Unfortunately upgrading to next v12 and above won't work because of the Webpack 4 as it's not supported anymore in newer version. Upgrading to Webpack 5 it's bringing issues with the collocated test files etc. The application will be upgraded but incrementally and for now I would like to know if there's any way we can have a more verbose debug logging because
javascript TypeError [ERR_INVALID_URL]: Invalid URL
it doesn't help at all.

To mention that NEXTAUTH_SECRET was added to the project during next-auth v4 upgrade.

Anyone can step in and provide some info on how this can be debugged further more?

Thanks a lot!

How to reproduce

This error only happens in the Gitlab pipelines and I can't seem to think an easy way to reproduce it nor I can't seem to get more details around the error as it's very vague.

Expected behavior

Should allow to successfully build the project

@netdesignr netdesignr added the triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. label Jan 23, 2023
@balazsorban44 balazsorban44 added the incomplete Insufficient reproduction. Without more info, we won't take further actions/provide help. label Jan 24, 2023
@github-actions
Copy link

We cannot recreate the issue with the provided information. Please add a reproduction in order for us to be able to investigate.

Why was this issue marked with the incomplete label?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository (template), but you can also use a tool like CodeSandbox or StackBlitz.

To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue.

Please test your reproduction against the latest version of NextAuth.js (next-auth@latest) to make sure your issue has not already been fixed.

I added a link, why was it still marked?

Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.

What happens if I don't provide a sufficient minimal reproduction?

Issues with the incomplete label that receives no meaningful activity (e.g. new comments with a reproduction link) are automatically closed and locked after 30 days.

If your issue has not been resolved in that time and it has been closed/locked, please open a new issue with the required reproduction.

I did not open this issue, but it is relevant to me, what can I do to help?

Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps. Furthermore, you can upvote the issue using the 👍 reaction on the topmost comment (please do not comment "I have the same issue" without repro steps). Then, we can sort issues by votes to prioritize.

I think my reproduction is good enough, why aren't you looking into it quicker?

We look into every NextAuth.js issue and constantly monitor open issues for new comments.

However, sometimes we might miss one or two. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.

Useful Resources

@netgfx
Copy link

netgfx commented Nov 3, 2023

I have the same issue with github actions, when I switched to next-auth (with iron-session the deployment was running fine)

Error occurred prerendering page "/login". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:387:5)
    at URL.onParseError (node:internal/url:565:9)
    at new URL (node:internal/url:641:5)
    at parseUrl (/home/runner/work/frontend-app/frontend-app/relivable-admin/relivable-admin/.next/server/chunks/8107.js:1370:16)
    at Object.63370 (/home/runner/work/frontend-app/frontend-app/relivable-admin/relivable-admin/.next/server/chunks/8107.js:621:34)
    at __webpack_require__ (/home/runner/work/frontend-app/frontend-app/relivable-admin/relivable-admin/.next/server/webpack-runtime.js:25:43)
    at Module.3512 (/home/runner/work/frontend-app/frontend-app/relivable-admin/relivable-admin/.next/server/app/login/page.js:291:73)
    at __webpack_require__ (/home/runner/work/frontend-app/frontend-app/relivable-admin/relivable-admin/.next/server/webpack-runtime.js:25:43)
    at O (/home/runner/work/frontend-app/frontend-app/relivable-admin/relivable-admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.min.js:23:142)
    at ia (/home/runner/work/frontend-app/frontend-app/relivable-admin/relivable-admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.min.js:27:301)
TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:387:5)
    at URL.onParseError (node:internal/url:565:9)
    at new URL (node:internal/url:641:5)
    at parseUrl (/home/runner/work/frontend-app/frontend-app/relivable-admin/relivable-admin/.next/server/chunks/8107.js:1370:16)
    at Object.63370 (/home/runner/work/frontend-app/frontend-app/relivable-admin/relivable-admin/.next/server/chunks/8107.js:621:34)
    at __webpack_require__ (/home/runner/work/frontend-app/frontend-app/relivable-admin/relivable-admin/.next/server/webpack-runtime.js:25:43)
    at Module.45829 (/home/runner/work/frontend-app/frontend-app/relivable-admin/relivable-admin/.next/server/chunks/3837.js:69:13)
    at __webpack_require__ (/home/runner/work/frontend-app/frontend-app/relivable-admin/relivable-admin/.next/server/webpack-runtime.js:25:43)
    at O (/home/runner/work/frontend-app/frontend-app/relivable-admin/relivable-admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.min.js:23:142)
    at da (/home/runner/work/frontend-app/frontend-app/relivable-admin/relivable-admin/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.min.js:20:89) {
  input: '',
  code: 'ERR_INVALID_URL'
}

Those issues shouldn't be closed

@bfg-coding
Copy link

I am getting a similar issue when I try to build using docker compose

"next-auth": "^4.24.7"

29.31    Collecting page data ...
29.93 TypeError: Invalid URL
29.93     at new URL (node:internal/url:796:36)
29.93     at t.default (/app/.next/server/chunks/676.js:30:25816)
29.93     at 12653 (/app/.next/server/chunks/653.js:1:7825)
29.93     at t (/app/.next/server/webpack-runtime.js:1:128)
29.93     at 48847 (/app/.next/server/app/auth/login/page.js:1:2313)
29.93     at t (/app/.next/server/webpack-runtime.js:1:128)
29.93     at 76565 (/app/.next/server/app/auth/login/page.js:1:1288)
29.93     at t (/app/.next/server/webpack-runtime.js:1:128)
29.93     at t (/app/.next/server/app/auth/login/page.js:1:2721)
29.93     at /app/.next/server/app/auth/login/page.js:1:2771 {
29.93   code: 'ERR_INVALID_URL',
29.93   input: ''
29.93 }
29.93
29.93 > Build error occurred
29.94 Error: Failed to collect page data for /auth/login
29.94     at /app/node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/build/utils.js:1268:15
29.94     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
29.94   type: 'Error'
29.94 }
29.98  ELIFECYCLE  Command failed with exit code 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incomplete Insufficient reproduction. Without more info, we won't take further actions/provide help. triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests

4 participants