now.json breaks Vercel Deployment
See original GitHub issueIssue:
I just realized that my nuxt apps have really poor Lighthouse metrics when I deploy them on vercel and from time to time, I am unable to visit the Site completely because of a 502 Bad gateway
error.
When I dug into this and searched for the source of this bad performance I realized that a freshly created nuxt app works like a charm. The issues start, as soon as I add the now.json from the offical Nuxt documentation.
Example project: https://github.com/thmsnhl/frenimals An example branch with now.json (502 Error): https://frenimals-git-feat-now-json.thmsnhl-voll.vercel.app/ An example branch without now.json: https://frenimals-git-feat-no-now-json.thmsnhl-voll.vercel.app/
Build logs
17:49:09.663 Installing build runtime...
17:49:13.586 Build runtime installed: 3923.155ms
17:49:14.252 Looking up build cache...
17:49:14.592 Build cache not found
17:49:15.243 Running with @nuxt/vercel-builder version 0.18.0
17:49:15.244 ----------------- Prepare build -----------------
17:49:15.244 Downloading files...
17:49:15.245 Working directory: /vercel/workpath0
17:49:15.257 Using yarn
17:49:15.263 ℹ Prepare build took: 18.516535 ms
17:49:15.263 ----------------- Install devDependencies -----------------
17:49:15.568 yarn install v1.22.4
17:49:15.675 [1/5] Resolving packages...
17:49:16.371 [2/5] Fetching packages...
17:49:36.161 info fsevents@2.1.3: The platform "linux" is incompatible with this module.
17:49:36.161 info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
17:49:36.177 info fsevents@1.2.13: The platform "linux" is incompatible with this module.
17:49:36.177 info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
17:49:36.183 [3/5] Linking dependencies...
17:49:36.186 warning "nuxt > @nuxt/components@1.1.1" has unmet peer dependency "webpack@^4.0.0".
17:49:36.196 warning "@nuxtjs/eslint-config > eslint-plugin-vue@6.2.2" has incorrect peer dependency "eslint@^5.0.0 || ^6.0.0".
17:49:36.196 warning "@nuxtjs/eslint-config > eslint-plugin-jest > @typescript-eslint/experimental-utils > @typescript-eslint/typescript-estree > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
17:49:36.196 warning "@nuxtjs/eslint-module > eslint-loader@4.0.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
17:49:36.197 warning "@nuxtjs/stylelint-module > stylelint-webpack-plugin@2.1.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
17:49:47.022 [4/5] Building fresh packages...
17:49:48.269 [5/5] Cleaning modules...
17:49:52.138 Done in 36.58s.
17:49:52.167 ℹ Install devDependencies took: 36902.785469 ms
17:49:52.167 ----------------- Nuxt build -----------------
17:49:52.202 Running nuxt build --standalone --no-lock --config-file "nuxt.config.js"
17:49:55.131 WARN [remark-footnotes] Warning: please upgrade to remark 13 to use this plugin
17:49:55.170 ℹ Parsed 1 files in 0,9 seconds
17:50:02.310 ℹ Production build
17:50:02.311 ℹ Bundling for server and client side
17:50:02.311 ℹ Target: static
17:50:02.338 ✔ Builder initialized
17:50:02.391 ✔ Nuxt files generated
17:50:04.959 ℹ Compiling Client
17:50:09.186 WARN
17:50:09.186 WARN warn - The conservative purge mode will be removed in Tailwind 2.0.
17:50:09.186 WARN warn - Please switch to the new layers mode instead.
17:50:18.933 ✔ Client: Compiled successfully in 13.97s
17:50:18.940 ℹ Compiling Server
17:50:22.666 ✔ Server: Compiled successfully in 3.73s
17:50:22.668 Hash: [1mf21cbb7b38a3c8feea96[39m[22m
17:50:22.668 Version: webpack [1m4.44.2[39m[22m
17:50:22.668 Time: [1m13976[39m[22mms
17:50:22.668 Built at: 11/17/2020 [1m4:50:18 PM[39m[22m
17:50:22.668 [1mAsset[39m[22m [1mSize[39m[22m [1mChunks[39m[22m [1m[39m[22m [1m[39m[22m [1mChunk Names[39m[22m
17:50:22.668 [1m[32m../server/client.manifest.json[39m[22m 10.5 KiB [1m[39m[22m [1m[32m[emitted][39m[22m
17:50:22.668 [1m[32m5043383.js[39m[22m 2.95 KiB [1m2[39m[22m [1m[32m[emitted] [immutable][39m[22m pages/index
17:50:22.668 [1m[32m79bf195.js[39m[22m 4.43 KiB [1m4[39m[22m [1m[32m[emitted] [immutable][39m[22m
17:50:22.668 [1m[32mLICENSES[39m[22m 318 bytes [1m[39m[22m [1m[32m[emitted][39m[22m
17:50:22.668 [1m[32mc60e772.js[39m[22m 2.32 KiB [1m3[39m[22m [1m[32m[emitted] [immutable][39m[22m runtime
17:50:22.668 [1m[33mdb7fed0.js[39m[22m [1m[33m285 KiB[39m[22m [1m0[39m[22m [1m[32m[emitted] [immutable][39m[22m [1m[33m[big][39m[22m app
17:50:22.668 [1m[32mfd08894.js[39m[22m 98.8 KiB [1m1[39m[22m [1m[32m[emitted] [immutable][39m[22m content/plugin.js
17:50:22.668 + 2 hidden assets
17:50:22.668 Entrypoint [1mapp[39m[22m = [1m[32mc60e772.js[39m[22m [1m[32mdb7fed0.js[39m[22m
17:50:22.668 [1m[33mWARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
17:50:22.669 This can impact web performance.
17:50:22.669 Assets:
17:50:22.669 db7fed0.js (285 KiB)[39m[22m
17:50:22.669 Hash: [1m4aa67d7f1cf64301cd2e[39m[22m
17:50:22.669 Version: webpack [1m4.44.2[39m[22m
17:50:22.669 Time: [1m3728[39m[22mms
17:50:22.669 Built at: 11/17/2020 [1m4:50:22 PM[39m[22m
17:50:22.669 [1mAsset[39m[22m [1mSize[39m[22m [1mChunks[39m[22m [1m[39m[22m [1m[39m[22m[1mChunk Names[39m[22m
17:50:22.669 [1m[32mpages/index.js[39m[22m 11.6 KiB [1m1[39m[22m [1m[32m[emitted][39m[22m pages/index
17:50:22.669 [1m[32mserver.js[39m[22m 472 KiB [1m0[39m[22m [1m[32m[emitted][39m[22m app
17:50:22.669 [1m[32mserver.manifest.json[39m[22m 207 bytes [1m[39m[22m [1m[32m[emitted][39m[22m
17:50:22.669 + 2 hidden assets
17:50:22.669 Entrypoint [1mapp[39m[22m = [1m[32mserver.js[39m[22m [1m[32mserver.js.map[39m[22m
17:50:22.677 ℹ Ready to run nuxt generate
17:50:26.747 ℹ Nuxt build took: 34579.09299 ms
17:50:26.747 ----------------- Install dependencies -----------------
17:50:27.055 yarn install v1.22.4
17:50:27.167 [1/5] Resolving packages...
17:50:28.160 [2/5] Fetching packages...
17:50:28.329 info fsevents@2.1.3: The platform "linux" is incompatible with this module.
17:50:28.329 info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
17:50:28.337 [3/5] Linking dependencies...
17:50:30.671 [4/5] Building fresh packages...
17:50:31.009 [5/5] Cleaning modules...
17:50:31.868 Done in 4.82s.
17:50:31.890 ℹ Install dependencies took: 5142.970839 ms
17:50:31.890 ----------------- Collect artifacts -----------------
17:50:37.705 ℹ Collect artifacts took: 5810.716694 ms
17:50:38.513 Uploading build outputs...
17:50:44.929 Build completed. Populating build cache...
17:50:45.255 ----------------- Collect cache -----------------
17:50:54.500 ℹ 68 files collected from .nuxt
17:51:06.084 ℹ 30543 files collected from .vercel_cache
17:51:17.007 ℹ 27313 files collected from node_modules_dev
17:51:26.698 ℹ 6760 files collected from node_modules_prod
17:51:26.703 ℹ Collect cache took: 41448.569059 ms
17:51:56.185 Uploading build cache [79.48 MB]...
17:52:00.508 Build cache uploaded: 4322.109ms
17:52:00.532 Done with "nuxt.config.js"
Error Logs
[GET] /
18:08:33:61
FATAL ENOENT: no such file or directory, mkdir '/var/task/.nuxt/dist/client'
2020-11-17T17:08:33.905Z d0281e6a-999a-4805-b8df-3515e68b9e25 ERROR Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: ENOENT: no such file or directory, open '/var/task/static/sw.js'","reason":{"errorType":"Error","errorMessage":"ENOENT: no such file or directory, open '/var/task/static/sw.js'","code":"ENOENT","errno":-2,"syscall":"open","path":"/var/task/static/sw.js","stack":["Error: ENOENT: no such file or directory, open '/var/task/static/sw.js'"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: ENOENT: no such file or directory, open '/var/task/static/sw.js'"," at process.<anonymous> (/var/runtime/index.js:35:15)"," at process.emit (events.js:327:22)"," at process.EventEmitter.emit (domain.js:483:12)"," at processEmit [as emit] (/var/task/node_modules/signal-exit/index.js:161:32)"," at processPromiseRejections (internal/process/promises.js:209:33)"," at processTicksAndRejections (internal/process/task_queues.js:98:32)"]}
Unknown application error occurred
Just let me know if there is anything else, that I can post here to make it easier to debug.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@danielroe sorry that it took me so long to come back to this. I adjusted the configuration to
target: 'server'
and was not able to reproduce the issues I had in the other project.However, it would be nice to have an error message pointing out that now.json should only be used with
target: 'server'
if current target is set to'static'
.Thanks again for helping me out and for your patience!
@danielroe thank you for reaching out and for clarifying this. I switched to a static target because the page load of an other site (
target: 'server'
) took more than 15 seconds before the first byte.I will try to recreate this effect tomorrow and close/update this issue if necessary.