Skip to content

Commit ddd3b63

Browse files
SG60Rich-Harrisdummdidumm
authored
Run server.init() for edge functions on Vercel (#6327)
* Run server.init() for edge functions on Vercel. Required since #6179. Closes #6308. * changeset * changes * remove async keyword * Update .changeset/strong-kangaroos-work.md * netlify edge functions * changeset Co-authored-by: Rich Harris <[email protected]> Co-authored-by: Simon H <[email protected]>
1 parent c3818b2 commit ddd3b63

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

.changeset/strong-kangaroos-work.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@sveltejs/adapter-vercel': patch
3+
'@sveltejs/adapter-netlify': patch
4+
---
5+
6+
Run `server.init()` for edge functions

packages/adapter-netlify/src/edge.js

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import { manifest, prerendered } from 'MANIFEST';
44
const server = new Server(manifest);
55
const prefix = `/${manifest.appDir}/`;
66

7+
await server.init({
8+
// @ts-ignore
9+
env: Deno.env.toObject()
10+
});
11+
712
/**
813
* @param { Request } request
914
* @param { any } context

packages/adapter-netlify/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"checkJs": true,
55
"noEmit": true,
66
"noImplicitAny": true,
7-
"module": "es2020",
7+
"module": "es2022",
8+
"target": "es2022",
89
"moduleResolution": "node",
910
"allowSyntheticDefaultImports": true,
1011
"baseUrl": ".",

packages/adapter-vercel/files/edge.js

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import { manifest } from 'MANIFEST';
33

44
const server = new Server(manifest);
55

6+
await server.init({
7+
env: process.env
8+
});
9+
610
/**
711
* @param {Request} request
812
*/

0 commit comments

Comments
 (0)