vercel / next.js

The React Framework
https://nextjs.org
MIT License
124.84k stars 26.65k forks source link

Deployment hangs while checking types #26373

Closed adriandelgado closed 3 years ago

adriandelgado commented 3 years ago

What version of Next.js are you using?

11.0.0

What version of Node.js are you using?

14.17.1

What browser are you using?

Brave

What operating system are you using?

archlinux

How are you deploying your application?

Vercel

Describe the Bug

Trying to deploy a new Next.js project to Vercel causes UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON

image

The build process doesn't stop. I had to manually cancel it.

This doesn't happen on my machine. Everything compiles just fine.

Expected Behavior

I expect the build to succeed without errors.

To Reproduce

This is a brand new project. .eslintrc:

{
  "plugins": ["prettier"],
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:prettier/recommended",
    "next",
    "next/core-web-vitals"
  ]
}

package.json

"dependencies": {
    "@headlessui/react": "^1.2.0",
    "axios": "^0.21.1",
    "next": "11.0.0",
    "next-seo": "^4.26.0",
    "react": "17.0.2",
    "react-dom": "17.0.2"
  },
  "devDependencies": {
    "@types/node": "^15.12.4",
    "@types/react": "17.0.11",
    "@types/react-dom": "^17.0.8",
    "@typescript-eslint/eslint-plugin": "^4.27.0",
    "autoprefixer": "^10.2.6",
    "eslint": "7.29.0",
    "eslint-config-next": "11.0.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^3.4.0",
    "postcss": "^8.3.5",
    "tailwindcss": "^2.2.2",
    "typescript": "4.3.4"
  }
timneutkens commented 3 years ago

Please provide a full reproduction as this can't be investigated with just a package.json and some configuration.

adriandelgado commented 3 years ago

Sure! Here is the public repository, the last two commits were attempts to make it work. Vercel-support forked the repository just two hours ago.

Aung-Myint-Thein commented 3 years ago

We have similar but different error on deployment too. It was working fine on Next 9.5.5 and when we upgraded to 11, got the following error and deployment hangs.

Screenshot 2021-06-22 at 9 03 10 PM

Any quick tips?

adriandelgado commented 3 years ago

The current workaround is to use next build --no-lint for now and try redeploying

This works for now. @Aung-Myint-Thein let me know if you find the root cause.

Aung-Myint-Thein commented 3 years ago

--no-lint is working but now it failed in a different place.. It said

Failed to compile.

./public/images/png/icon_apply_tutor.png
CompileError: AsyncCompile: Wasm decoding failed: mutable globals cannot be exported @+482

> Build error occurred
Error: > Build failed because of webpack errors
    at nextBuildSpan.traceAsyncFn (/root/projects/next_website/node_modules/next/dist/build/index.js:15:924)

The file is there and working in development. :D any tips..? I am using Next/Image

IvanRodriCalleja commented 3 years ago

@adriandelgado The error happens because you miss some dependencies (in this case prettier).

The error message should be improved because it is not clear, I have been looking for a solution but i can't figure out why eslint recieves the right message and the NexJS execution doesn't.

The EsLint CLI runs this function:

https://github.com/eslint/eslint/blob/fa1c07c0d65ce21a30f5bb4a9f2ac511f8df6446/lib/cli.js#L301

This is the same as executed in NextJS:

https://github.com/vercel/next.js/blob/46e7658f7e5956af055cf9335049681b116d40d2/packages/next/lib/eslint/runLintCheck.ts#L115

The only difference i see is how eslint catch the errors: https://github.com/eslint/eslint/blob/fa1c07c0d65ce21a30f5bb4a9f2ac511f8df6446/bin/eslint.js#L122-L123 https://github.com/eslint/eslint/blob/fa1c07c0d65ce21a30f5bb4a9f2ac511f8df6446/bin/eslint.js#L67-L115

Capturing exceptions in NextJS in the same way results in inaccurate error too so i don't know why they have diferent behaviour. I'll continue researching and i'll open a PR if i find why it happens.

adriandelgado commented 3 years ago

@IvanRodriCalleja You are right, the error message is very cryptic and doesn't help very much. Installing prettier fixes everything. I realized that while working on another project but forgot to update this issue.

aidan-rypens commented 3 years ago

This is also happening to me with PNG's. Are they supported in nextjs?

balazsorban44 commented 2 years ago

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.