Skip to content

Commit 01570e9

Browse files
feat: update edge functions bootstrap (#5672)
1 parent be998a0 commit 01570e9

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

src/lib/edge-functions/bootstrap.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { env } from 'process'
22

3-
const latestBootstrapURL = 'https://643581608391e3000851cc94--edge.netlify.com/bootstrap/index-combined.ts'
3+
const latestBootstrapURL = 'https://64523ab4e7865600087fc3df--edge.netlify.com/bootstrap/index-combined.ts'
44

55
export const getBootstrapURL = () => env.NETLIFY_EDGE_BOOTSTRAP || latestBootstrapURL

tests/integration/100.command.dev.test.cjs

+26-15
Original file line numberDiff line numberDiff line change
@@ -1015,8 +1015,14 @@ test('should have only allowed environment variables set', async (t) => {
10151015
},
10161016
})
10171017
.withEdgeFunction({
1018-
// eslint-disable-next-line no-undef
1019-
handler: () => new Response(`${JSON.stringify(Deno.env.toObject())}`),
1018+
handler: () => {
1019+
// eslint-disable-next-line no-undef
1020+
const fromDenoGlobal = Deno.env.toObject()
1021+
// eslint-disable-next-line no-undef
1022+
const fromNetlifyGlobal = Netlify.env.toObject()
1023+
1024+
return new Response(`${JSON.stringify({ fromDenoGlobal, fromNetlifyGlobal })}`)
1025+
},
10201026
name: 'env',
10211027
})
10221028
.withContentFile({
@@ -1041,24 +1047,29 @@ test('should have only allowed environment variables set', async (t) => {
10411047
const response = await got(`http://localhost:${port}/env`).then((edgeResponse) =>
10421048
JSON.parse(edgeResponse.body),
10431049
)
1044-
const envKeys = Object.keys(response)
1050+
const buckets = Object.values(response)
1051+
t.is(buckets.length, 2)
1052+
1053+
buckets.forEach((bucket) => {
1054+
const bucketKeys = Object.keys(bucket)
10451055

1046-
t.true(envKeys.includes('DENO_REGION'))
1047-
t.is(response.DENO_REGION, 'local')
1056+
t.true(bucketKeys.includes('DENO_REGION'))
1057+
t.is(bucket.DENO_REGION, 'local')
10481058

1049-
t.true(envKeys.includes('NETLIFY_DEV'))
1050-
t.is(response.NETLIFY_DEV, 'true')
1059+
t.true(bucketKeys.includes('NETLIFY_DEV'))
1060+
t.is(bucket.NETLIFY_DEV, 'true')
10511061

1052-
t.true(envKeys.includes('SECRET_ENV'))
1053-
t.is(response.SECRET_ENV, 'true')
1062+
t.true(bucketKeys.includes('SECRET_ENV'))
1063+
t.is(bucket.SECRET_ENV, 'true')
10541064

1055-
t.true(envKeys.includes('FROM_ENV'))
1056-
t.is(response.FROM_ENV, 'YAS')
1065+
t.true(bucketKeys.includes('FROM_ENV'))
1066+
t.is(bucket.FROM_ENV, 'YAS')
10571067

1058-
t.false(envKeys.includes('DENO_DEPLOYMENT_ID'))
1059-
t.false(envKeys.includes('NODE_ENV'))
1060-
t.false(envKeys.includes('DEPLOY_URL'))
1061-
t.false(envKeys.includes('URL'))
1068+
t.false(bucketKeys.includes('DENO_DEPLOYMENT_ID'))
1069+
t.false(bucketKeys.includes('NODE_ENV'))
1070+
t.false(bucketKeys.includes('DEPLOY_URL'))
1071+
t.false(bucketKeys.includes('URL'))
1072+
})
10621073
},
10631074
)
10641075
})

0 commit comments

Comments
 (0)