-
Notifications
You must be signed in to change notification settings - Fork 176
Feat: Allow overriding the proxying for external rewrite #630
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5ecfc3e
proxyRequest is now an override
conico974 055d1a8
handle errors in request handler
conico974 e744a79
review fix
conico974 143f1c4
add dummy type everywhere
conico974 ba535b7
handle error in middleware
conico974 2c73d9a
review fix
conico974 3b41f89
Update packages/open-next/src/core/requestHandler.ts
conico974 b677414
review
conico974 d409b7d
added comment
conico974 fc0f0a4
review fix
conico974 b165231
fix build
conico974 8ea7d39
Create strong-keys-ring.md
conico974 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import type { | ||
BaseEventOrResult, | ||
DefaultOverrideOptions, | ||
IncludedProxyExternalRequest, | ||
IncludedWarmer, | ||
InternalEvent, | ||
InternalResult, | ||
LazyLoadedOverride, | ||
|
@@ -10,6 +12,7 @@ import type { | |
Converter, | ||
ImageLoader, | ||
OriginResolver, | ||
ProxyExternalRequest, | ||
TagCache, | ||
Warmer, | ||
Wrapper, | ||
|
@@ -122,11 +125,26 @@ export async function resolveOriginResolver( | |
* @__PURE__ | ||
*/ | ||
export async function resolveWarmerInvoke( | ||
warmer?: LazyLoadedOverride<Warmer> | "aws-lambda", | ||
warmer?: LazyLoadedOverride<Warmer> | IncludedWarmer, | ||
|
||
) { | ||
if (typeof warmer === "function") { | ||
return warmer(); | ||
} | ||
const m_1 = await import("../overrides/warmer/aws-lambda.js"); | ||
return m_1.default; | ||
} | ||
|
||
/** | ||
* @__PURE__ | ||
*/ | ||
export async function resolveProxyRequest( | ||
proxyRequest?: | ||
| LazyLoadedOverride<ProxyExternalRequest> | ||
| IncludedProxyExternalRequest, | ||
) { | ||
if (typeof proxyRequest === "function") { | ||
return proxyRequest(); | ||
} | ||
const m_1 = await import("../overrides/proxyExternalRequest/node.js"); | ||
return m_1.default; | ||
} |
This file contains hidden or 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
This file contains hidden or 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
10 changes: 10 additions & 0 deletions
10
packages/open-next/src/overrides/proxyExternalRequest/dummy.ts
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { ProxyExternalRequest } from "types/overrides"; | ||
|
||
const DummyProxyExternalRequest: ProxyExternalRequest = { | ||
name: "dummy", | ||
proxy: async (_event) => { | ||
throw new Error("This is a dummy implementation"); | ||
}, | ||
}; | ||
|
||
export default DummyProxyExternalRequest; |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.