Blitz: Blitz start is crashing on compile errors with UnhandledPromiseRejectionWarning

Created on 26 Apr 2020  Â·  11Comments  Â·  Source: blitz-js/blitz

What is the problem?

blitz start fails on some type of compile error, like trying to import a non-existent dependency.

The actual blitz start process keeps running, but the spawned next process crashes and isn't restarted

Steps to Reproduce:

  1. Checkout latest canary
  2. yarn
  3. yarn build
  4. cd examples/tailwind
  5. yarn remove tailwindcss
  6. blitz start
  7. See error

Supporting Documentation

Warning: You have enabled experimental feature(s).
Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use them at your own risk.

Error: Cannot find module 'tailwindcss' from '/Users/b/c/blitz/examples/tailwind/.blitz/caches/dev/'
    at Function.e.exports [as sync] (/Users/b/c/blitz/node_modules/next/dist/compiled/resolve/index.js:1:1388)
    at resolveRequest (/Users/b/c/blitz/node_modules/next/dist/lib/resolve-request.js:4:287)
    at loadPlugin (/Users/b/c/blitz/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js:1:1667)
    at /Users/b/c/blitz/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js:7:1761
    at Array.map (<anonymous>)
    at getPostCssPlugins (/Users/b/c/blitz/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js:7:1754)
    at async __overrideCssConfiguration (/Users/b/c/blitz/node_modules/next/dist/build/webpack/config/blocks/css/overrideCssConfiguration.js:1:272)
    at async getBaseWebpackConfig (/Users/b/c/blitz/node_modules/next/dist/build/webpack-config.js:101:120)
    at async Promise.all (index 0)
    at async HotReloader.start (/Users/b/c/blitz/node_modules/next/dist/server/hot-reloader.js:14:1788)
    at async DevServer.prepare (/Users/b/c/blitz/node_modules/next/dist/server/next-dev-server.js:10:1565)
    at async /Users/b/c/blitz/node_modules/next/dist/cli/next-dev.js:21:359 {
  code: 'MODULE_NOT_FOUND'
}
(node:44344) UnhandledPromiseRejectionWarning: 'next build' failed with status code: 1
(node:44344) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:44344) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Processing file...package.json
kinbug priorithigh statuready-to-work-on

All 11 comments

This same crash occurs if you are using a component from app/components/Thing.js and you change the code inside Thing.js while blitz is running

Having reproducability issues. Is it possible to be more explicit about steps to reproduce?

Oh is this in a js project?

I am still struggling to reproduce within the example app in the monorepo despite using js files. Perhaps you can share a repository?

@ryardley I just updated the issue with exact steps — sorry about that

Ok great will try

Also I just verified that Next.js does exit with an error for this, so we need to just exit too.

And I can't reproduce the error I saw when changing the component file

Issue is a missing await will push a fix

While you are at it, it looks like the log for this prints next build but it should be next dev, right?

Yep I am onto that. Just making tests work with passing in a mock synchronizer

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MrLeebo picture MrLeebo  Â·  5Comments

aaronfulkerson picture aaronfulkerson  Â·  3Comments

svobik7 picture svobik7  Â·  3Comments

flybayer picture flybayer  Â·  3Comments

ganeshmani picture ganeshmani  Â·  4Comments