question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

now.json breaks Vercel Deployment

See original GitHub issue

Issue: 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: f21cbb7b38a3c8feea96
17:50:22.668  	Version: webpack 4.44.2
17:50:22.668  	Time: 13976ms
17:50:22.668  	Built at: 11/17/2020 4:50:18 PM
17:50:22.668  	                         Asset       Size  Chunks                                Chunk Names
17:50:22.668  	../server/client.manifest.json   10.5 KiB          [emitted]                     
17:50:22.668  	                    5043383.js   2.95 KiB       2  [emitted] [immutable]         pages/index
17:50:22.668  	                    79bf195.js   4.43 KiB       4  [emitted] [immutable]         
17:50:22.668  	                      LICENSES  318 bytes          [emitted]                     
17:50:22.668  	                    c60e772.js   2.32 KiB       3  [emitted] [immutable]         runtime
17:50:22.668  	                    db7fed0.js    285 KiB       0  [emitted] [immutable]  [big]  app
17:50:22.668  	                    fd08894.js   98.8 KiB       1  [emitted] [immutable]         content/plugin.js
17:50:22.668  	 + 2 hidden assets
17:50:22.668  	Entrypoint app = c60e772.js db7fed0.js
17:50:22.668  	WARNING 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)
17:50:22.669  	Hash: 4aa67d7f1cf64301cd2e
17:50:22.669  	Version: webpack 4.44.2
17:50:22.669  	Time: 3728ms
17:50:22.669  	Built at: 11/17/2020 4:50:22 PM
17:50:22.669  	               Asset       Size  Chunks             Chunk Names
17:50:22.669  	      pages/index.js   11.6 KiB       1  [emitted]  pages/index
17:50:22.669  	           server.js    472 KiB       0  [emitted]  app
17:50:22.669  	server.manifest.json  207 bytes          [emitted]  
17:50:22.669  	 + 2 hidden assets
17:50:22.669  	Entrypoint app = server.js server.js.map
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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
thmsnhlcommented, Nov 28, 2020

@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!

1reaction
thmsnhlcommented, Nov 18, 2020

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Project Config with vercel.json
A complete reference for Vercel project configurations using vercel.json. ... By default, no configuration is needed to deploy Serverless Functions to ...
Read more >
NextJs vercel deployment error "routes-manifest.json" couldn't ...
My nextjs app was working properly I added some files to update my code now it is not deploying my app on ...
Read more >
Vercel Deployment Issue - Endless Loop - Get Help
I have tried deleting the “builds” option from the vercel.json file, ... some change in vercel has caused the @frontity/now package to break...
Read more >
How to add Firebase service account json files to Vercel
How to add Firebase service account json files to Vercel · 1. Download the service account JSON file · 2. Remove line breaks...
Read more >
Deploy SPA with react-router to Vercel - Today I Solved
It means servers don't know how to handle sub-pages (URLs) like yourdomain.com/my-page. How. Make vercel.json file in your root directory, then ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found