[cli][dev] handle no response from edge functions (#8095)

When an edge function has no response during `vc dev`, we were seeing an unhelpful error message:

> The event listener did not respond.

Now, we'll see a much more specific error message:

> Unhandled rejection: Edge Function "api/edge-no-response.ts" did not return a response.
> Error! Failed to complete request to /api/edge-no-response: Error: socket hang up
This commit is contained in:
Sean Massa
2022-07-20 15:09:29 -05:00
committed by GitHub
parent 66c8544e8f
commit 5dc6f48e44
6 changed files with 72 additions and 9 deletions

View File

@@ -442,6 +442,17 @@ test(
})
);
test(
'[vercel dev] Middleware that has no response',
testFixtureStdio('middleware-no-response', async (testPath: any) => {
await testPath(
500,
'/api/hello',
'A server error has occurred\n\nEDGE_FUNCTION_INVOCATION_FAILED'
);
})
);
test(
'[vercel dev] Middleware that does basic rewrite',
testFixtureStdio('middleware-rewrite', async (testPath: any) => {