Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes when tracing apollo-upload-client #141

Closed
jaydenseric opened this issue Jul 27, 2020 · 1 comment · Fixed by #144 or vercel/vercel#4933
Closed

Crashes when tracing apollo-upload-client #141

jaydenseric opened this issue Jul 27, 2020 · 1 comment · Fixed by #144 or vercel/vercel#4933
Labels
bug Something isn't working

Comments

@jaydenseric
Copy link

jaydenseric commented Jul 27, 2020

There are certain situations where nodeFileTrace crashes on perfectly valid modules. This critical bug is causing Vercel deployment errors for apollo-upload-client (see jaydenseric/apollo-upload-client#211) and next-graphql-react/graphql-react users.

For example:

const { nodeFileTrace } = require('@zeit/node-file-trace');
nodeFileTrace(['index.js']).then(console.log)

With index.js containing:

const ReactNativeFile = require('apollo-upload-client/public/ReactNativeFile')

Or alternatively containing:

const { ReactNativeFile } = require('apollo-upload-client')

nodeFileTrace crashes with an unhandled promise rejection:

(node:4082) UnhandledPromiseRejectionWarning: Error: File /[redacted]/node_modules/apollo-upload-clientpublic/ReactNativeFile does not exist.
    at Job.emitDependency (/[redacted]/node_modules/@zeit/node-file-trace/out/node-file-trace.js:261:23)
    at /[redacted]/node_modules/@zeit/node-file-trace/out/node-file-trace.js:290:36
    at async Promise.all (index 0)
    at async Job.emitDependency (/[redacted]/node_modules/@zeit/node-file-trace/out/node-file-trace.js:268:9)
    at async /[redacted]/node_modules/@zeit/node-file-trace/out/node-file-trace.js:297:21
    at async Promise.all (index 0)
    at async Job.emitDependency (/[redacted]/node_modules/@zeit/node-file-trace/out/node-file-trace.js:268:9)
    at async Promise.all (index 0)
    at async nodeFileTrace (/[redacted]/node_modules/@zeit/node-file-trace/out/node-file-trace.js:27:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:4082) 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: 2)
(node:4082) [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.

It seems to crash when one module re-exports something from another?

For example, if you replace the contents of index.js with:

const ReactNativeFile = require('extract-files/public/ReactNativeFile')

There is no crash.

@styfle
Copy link
Member

styfle commented Jul 27, 2020

Thanks for reporting this bug! We'll get it fixed soon 👍

@styfle styfle linked a pull request Jul 27, 2020 that will close this issue
@styfle styfle changed the title Crashes when tracing Crashes when tracing apollo-upload-client Jul 27, 2020
@kodiakhq kodiakhq bot closed this as completed in #144 Jul 27, 2020
styfle added a commit to vercel/vercel that referenced this issue Jul 28, 2020
This PR bumps `node-file-trace` to [0.8.1](https://github.com/vercel/node-file-trace/releases/tag/0.8.1) to fix ESM packages used with `require()`.

Fixes vercel/nft#141
ofhouse pushed a commit to milliHQ/terraform-aws-next-js that referenced this issue Mar 13, 2021
This PR bumps `node-file-trace` to [0.8.1](https://github.com/vercel/node-file-trace/releases/tag/0.8.1) to fix ESM packages used with `require()`.

Fixes vercel/nft#141
onlinehub0808 added a commit to onlinehub0808/terrafirn-aws-next.js that referenced this issue Mar 1, 2023
This PR bumps `node-file-trace` to [0.8.1](https://github.com/vercel/node-file-trace/releases/tag/0.8.1) to fix ESM packages used with `require()`.

Fixes vercel/nft#141
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants