Skip to content

Commit

Permalink
refactor: graceful error when cannot get bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jan 22, 2024
1 parent b129876 commit 762f747
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/runtime/plugin.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ export default <NitroAppPlugin>function (nitroApp) {
nitroApp.hooks.hook("request", async (event) => {
// Lazy initialize proxy when first request comes in
if (!_proxy) {
_proxy = getBindingsProxy();
_proxy = getBindingsProxy().catch((error) => {
console.error("Failed to initialize wrangler bindings proxy", error);
return { bindings: {}, dispose: () => Promise.resolve() };
});
}

// Inject proxy bindings to the request context
Expand Down

0 comments on commit 762f747

Please sign in to comment.