-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix(test): enable nodejs compat for miniflare #127
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fforbeck
force-pushed
the
fix/test-miniflare
branch
3 times, most recently
from
November 6, 2024 17:05
7b671a8
to
9e1f180
Compare
fforbeck
force-pushed
the
fix/test-miniflare
branch
from
November 6, 2024 17:15
9e1f180
to
d913ff9
Compare
Peeja
approved these changes
Nov 6, 2024
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.
Nice
hannahhoward
pushed a commit
that referenced
this pull request
Nov 9, 2024
🤖 I have created a release *beep* *boop* --- ## [2.21.0](v2.20.2...v2.21.0) (2024-11-06) ### Features * **blob-fetcher:** use updated blob fetcher ([#124](#124)) ([90bb605](90bb605)) * egress tracker middleware ([#120](#120)) ([847829b](847829b)) * rate limiter + unit tests + readme ([#115](#115)) ([7bc4c6d](7bc4c6d)) ### Bug Fixes * **test:** enable nodejs compat for miniflare ([#127](#127)) ([0165521](0165521)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix for Node.js Built-in Module Resolution in Cloudflare Worker Miniflare Tests
Overview
This PR addresses an issue with resolving Node.js built-in modules (
node:buffer
,node:events
,node:async_hooks
) in a Cloudflare Worker Test environment. The Worker encountered errors in resolving these built-in modules, which aren’t natively supported in Workers.This issue was introduced when the Opentelemetry PR was merged, but we didn't see that because the Github Action that runs the
test:miniflare
was not flagging the test failure.Error Description
During testing, the following error appeared:
Solution
To resolve this, I've enabled the
nodejs_compat
compatibility flag in thetest/miniflare/freeway.spec.js
file - which allows the Cloudflare Miniflare Worker to utilize Node.js runtime APIs, and set the compatibility date to "2024-09-23", as suggested in their docs: https://developers.cloudflare.com/workers/runtime-apis/nodejs/#get-startedUpdated the Github Action to halt the execution in case of test failures
Updated the wrangler package to clean up some warnings during the integration tests.
Note
As of September 23, 2024, enabling
nodejs_compat
applies the same behavior asnodejs_compat_v2
for compatibility dates set to September 23, 2024 or later, meaning this configuration is fully aligned with the latest runtime support for Node.js compatibility in Workers.