-
Notifications
You must be signed in to change notification settings - Fork 770
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
feat: recommend node compat on builtin use #1027
Conversation
🦋 Changeset detectedLatest commit: 5c4145f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/2333487697/npm-package-wrangler-1027 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/1027/npm-package-wrangler-1027 Or you can use npx https://prerelease-registry.developers.workers.dev/runs/2333487697/npm-package-wrangler-1027 dev path/to/script.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a test! Write a test that tries to bundle a worker with a node built in, and make sure it throws the error you specified
The windows CI failure is because of #977, investigating that separately |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! This should be a patch changeset btw. Approving for now, but please don't land until we fix the windows CI issue, thanks!
Co-authored-by: Sunil Pai <[email protected]>
), | ||
}, | ||
() => { | ||
throw new Error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use the logger Error utility
logger.error()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We went it to throw an error though, not just log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw
the logger.error
or we should add the ability to pass a option that has the logger throw Error
seems like it should somehow be consistent and utilize the utility, I will unblock the PR regardless
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand, the logger only logs, but we want this to be an exception. We log the error to the terminal the error when it gets caught anyway. Where are we missing consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand, the logger only logs, but we want this to be an exception. We log the error to the terminal the error when it gets caught anyway. Where are we missing consistency?
logger.error
seems redundant then, you can also throw anything. Consistency is lost in how we console out log errors vs exceptions errors, one has a custom format the other is default system format. Not causing a SIGTERM for some console errors makes sense I suppose like in validation so you can collect all the errors before SIGTERM, I just don't understand why they need to look different too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait maybe I missed this,
We log the error to the terminal the error when it gets caught anyway.
All Errors are now passed into the logger.error
?
If that is the case ignore everything I said because that is what I was implying we do, one way or another.
EDIT: confirmed in exception handlers the error is passed into logger.error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rozenmd could you add a small screenshot of what the error looks like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@threepointone: (using the latest branch preview in this PR)
TODO:
Closes #989