Skip to content

Commit c3b7e7c

Browse files
matthewpematipico
andauthored
Remove default throw behavior in astro:env (#12480)
Co-authored-by: Emanuele Stoppa <[email protected]>
1 parent 46f6b38 commit c3b7e7c

File tree

4 files changed

+5
-20
lines changed

4 files changed

+5
-20
lines changed

.changeset/early-scissors-beg.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Removes the default throw behavior in `astro:env`

packages/astro/src/core/app/pipeline.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export class AppPipeline extends Pipeline {
5454
undefined,
5555
undefined,
5656
undefined,
57-
false,
5857
defaultRoutes,
5958
);
6059
pipeline.#manifestData = manifestData;

packages/astro/src/core/base-pipeline.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export abstract class Pipeline {
5757
* Used for `Astro.site`.
5858
*/
5959
readonly site = manifest.site ? new URL(manifest.site) : undefined,
60-
readonly callSetGetEnv = true,
6160
/**
6261
* Array of built-in, internal, routes.
6362
* Used to find the route module
@@ -71,13 +70,6 @@ export abstract class Pipeline {
7170
createI18nMiddleware(i18n, manifest.base, manifest.trailingSlash, manifest.buildFormat),
7271
);
7372
}
74-
// In SSR, getSecret should fail by default. Setting it here will run before the
75-
// adapter override.
76-
if (callSetGetEnv && manifest.experimentalEnvGetSecretEnabled) {
77-
setGetEnv(() => {
78-
throw new AstroError(AstroErrorData.EnvUnsupportedGetSecret);
79-
}, true);
80-
}
8173
}
8274

8375
abstract headElements(routeData: RouteData): Promise<HeadElements> | HeadElements;

packages/astro/src/core/errors/errors-data.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,17 +1174,6 @@ export const EnvInvalidVariables = {
11741174
`The following environment variables defined in \`experimental.env.schema\` are invalid:\n\n${errors.map((err) => `- ${err}`).join('\n')}\n`,
11751175
} satisfies ErrorData;
11761176

1177-
/**
1178-
* @docs
1179-
* @description
1180-
* The `astro:env/server` exported function `getSecret()` is not supported by your adapter.
1181-
*/
1182-
export const EnvUnsupportedGetSecret = {
1183-
name: 'EnvUnsupportedGetSecret',
1184-
title: 'Unsupported astro:env getSecret',
1185-
message: '`astro:env/server` exported function `getSecret` is not supported by your adapter.',
1186-
} satisfies ErrorData;
1187-
11881177
/**
11891178
* @docs
11901179
* @description

0 commit comments

Comments
 (0)