Open
Description
See:
- feat: add a cloudflare-streaming wrapper #642 (comment)
- refactor(cloudflare): rename the "cloudflare" wrapper to "cloudflare-edge" #645 (review)
I was looking at improving the configuration validation after the comment in #642
However I think a prerequisite would be to refactor the code before we do the validation:
- some defaults are applied in the resolve plugin
- the edge bundle uses other defaults
- sometime we rely on the name
Maybe we should:
- Resolve the Open Next config early - that is fill in the defaults when no provided
- Used the resolved config for validation
@conico974, you have much more experience than me with the codebase, what do you think?
Activity
conico974 commentedon Nov 25, 2024
I think the main issue here is that we are mixing the
edge
runtime from Next, and theedge
runtime from cloudflare.My take on this is that we should only use
edge
for the Next edge runtime and find another name for cloudflare (or other) running runtime.As for the prerequisite that you mentionned an easy fix would be to add an
isEdgeRuntime
(the Next one) param in the resolve plugin and apply different set of default overrides in this case instead of only the default one hereopennextjs-aws/packages/open-next/src/plugins/resolve.ts
Lines 57 to 67 in f685dde
We should never rely on the name btw (that's my bad) as it could be a custom override.
That's a good idea, but this will need to be done on a per function basis because each one could use very different overrides. We could compute some kind of OverrideObject that would contain everything we need
We can merge #642 and handle all of this in a different PR