Skip to content

Conversation

sommeeeer
Copy link
Contributor

@sommeeeer sommeeeer commented Sep 3, 2025

If you have enableCacheInterception enabled includeCache will be true there, meaning esbuild will potentially bundle aws4fetch and the fallback overrides(sqs-lite, dynamodb-lite & s3-lite) in the middleware handler file. This can happen if you build from the Cloudflare adapter cause the overrides can contain anonymous functions and the override function would return undefined.

To see this your self, build the examples/e2e/app-router in cloudflare repo and look for aws4fetch, sqs-lite etc.. in the middleware handler file. Do we really need to pass any values here tho? I can't find any of them bundled in the middleware handler, even with this fix.

# before
124K    .open-next/middleware/handler.mjs
# after
104K    .open-next/middleware/handler.mjs

Copy link

changeset-bot bot commented Sep 3, 2025

🦋 Changeset detected

Latest commit: b5906f1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@opennextjs/aws Patch
app-pages-router Patch
app-router Patch

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

Copy link

pkg-pr-new bot commented Sep 3, 2025

Open in StackBlitz

pnpm add https://pkg.pr.new/@opennextjs/aws@975

commit: b5906f1

@sommeeeer sommeeeer changed the title fix(build): Support function-valued overrides in override helper fix(build): Refactor fallback values to be dummy overrides in createEdgeBundle Sep 6, 2025
@sommeeeer sommeeeer requested a review from conico974 September 6, 2025 07:52
This reverts commit a7ad1a2.
@sommeeeer sommeeeer requested a review from conico974 September 7, 2025 09:29
Copy link
Contributor

@conico974 conico974 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok sorry and nevermind all prior message. I read it on my phone and for some reason I thought you removed this line typeof overrides?.[target] === "function"
LGTM Thanks

@conico974 conico974 merged commit fd95b22 into opennextjs:main Sep 7, 2025
3 checks passed
@sommeeeer sommeeeer deleted the fix-override-func-edge-bundle branch September 7, 2025 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants