-
Notifications
You must be signed in to change notification settings - Fork 337
Import @hapi/joi in Worker cause error #393
Comments
Thanks for the report. Could you please run the same command with a detailed stacktrace: |
As seen in #393 previously JSON decoding errors are obscure. This changes improve the debugging in two cases: - The `package.json` file fails to decode; now emits a clearer error. - The wranglerjs backend returns an invalid JSON; now preserves the output file for further investigation. The console doesn't print the output file location by default, you need to pass `RUST_LOG=info` while running `wrangler build` and search for `--output-file=FILE` argument passed to wranglerjs.
this is stacktrace i get:
|
As seen in #393 previously JSON decoding errors are obscure. This changes improve the debugging in three cases: - The `package.json` file fails to decode; now emits a clearer error. - The wranglerjs backend returns an invalid JSON; now preserves the output file for further investigation. The console doesn't print the output file location by default, you need to pass `RUST_LOG=info` while running `wrangler build` and search for `--output-file=FILE` argument passed to wranglerjs. - The preview service returns invalid JSON; now emits a clearer error and full output can be seen using `RUST_LOG=info`
As seen in #393 previously JSON decoding errors are obscure. This changes improve the debugging in three cases: - The `package.json` file fails to decode; now emits a clearer error. - The wranglerjs backend returns an invalid JSON; now preserves the output file for further investigation. The console doesn't print the output file location by default, you need to pass `RUST_LOG=info` while running `wrangler build` and search for `--output-file=FILE` argument passed to wranglerjs. - The preview service returns invalid JSON; now emits a clearer error and full output can be seen using `RUST_LOG=info`
We just merged a patch #394, would you mind installing wrangler from source, trying to run |
below the result, it work ok when i comment out
and this after i enable the
it seem the issue because the size more than 1Mb. if that so, how can i allow more bigger package to be work? |
you might want to look into this issue: hapijs/joi#528 and into the slightly outdated |
hey @hbinduni ! I think there are a couple of things we can do to make this clearer:
✨ Built successfully, built project size is 1 MiB. ⚠️ Your built project has grown past the 1MiB size limit and may fail to deploy. ⚠️ ✨ We can reduce a good deal of confusion by making this error more prominent.
As to your question, the limits on script size are imposed by the Cloudflare Workers platform, not by Wrangler; Wrangler just checks on your behalf. You can make adjustments to your custom Webpack config that reduce the size for Workers, such as disabling source maps, turning on minification, etc. edit: new issue opened to address the above: #417 |
Hi, i use
webpack
and try to import@hapi/joi
like this:It build successfully but in preview, it return error:
Error: Error("expected value", line: 2, column: 1)
If i remove
import Joi
part, everything goes well. Can you help to fixed this?below my
webpack.config.js
:I put another post in cloudflare community for workers.
The text was updated successfully, but these errors were encountered: