mirror of
https://github.com/withastro/astro.git
synced 2025-04-07 23:41:43 -05:00
Allow async functions in the Vercel edge middleware integration (#9334)
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> Co-authored-by: Arsh <69170106+lilnasy@users.noreply.github.com> Co-authored-by: lilnasy <69170106+lilnasy@users.noreply.github.com>
This commit is contained in:
parent
3e4109b08f
commit
dfbc707908
2 changed files with 6 additions and 1 deletions
5
.changeset/young-spoons-rescue.md
Normal file
5
.changeset/young-spoons-rescue.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/vercel': patch
|
||||
---
|
||||
|
||||
Allows the edge middleware to be an async function.
|
|
@ -53,7 +53,7 @@ function edgeMiddlewareTemplate(middlewarePath: string, vercelEdgeMiddlewareHand
|
|||
if (existsSync(filePathEdgeMiddleware + '.js') || existsSync(filePathEdgeMiddleware + '.ts')) {
|
||||
const stringified = JSON.stringify(filePathEdgeMiddleware.replace(/\\/g, '/'));
|
||||
handlerTemplateImport = `import handler from ${stringified}`;
|
||||
handlerTemplateCall = `handler({ request, context })`;
|
||||
handlerTemplateCall = `await handler({ request, context })`;
|
||||
} else {
|
||||
}
|
||||
return `
|
||||
|
|
Loading…
Add table
Reference in a new issue