0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

Remove default throw behavior in astro:env (#12480)

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
This commit is contained in:
Matthew Phillips 2024-11-20 06:09:43 -05:00 committed by GitHub
parent 46f6b386b3
commit c3b7e7cfa1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 20 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Removes the default throw behavior in `astro:env`

View file

@ -54,7 +54,6 @@ export class AppPipeline extends Pipeline {
undefined,
undefined,
undefined,
false,
defaultRoutes,
);
pipeline.#manifestData = manifestData;

View file

@ -57,7 +57,6 @@ export abstract class Pipeline {
* Used for `Astro.site`.
*/
readonly site = manifest.site ? new URL(manifest.site) : undefined,
readonly callSetGetEnv = true,
/**
* Array of built-in, internal, routes.
* Used to find the route module
@ -71,13 +70,6 @@ export abstract class Pipeline {
createI18nMiddleware(i18n, manifest.base, manifest.trailingSlash, manifest.buildFormat),
);
}
// In SSR, getSecret should fail by default. Setting it here will run before the
// adapter override.
if (callSetGetEnv && manifest.experimentalEnvGetSecretEnabled) {
setGetEnv(() => {
throw new AstroError(AstroErrorData.EnvUnsupportedGetSecret);
}, true);
}
}
abstract headElements(routeData: RouteData): Promise<HeadElements> | HeadElements;

View file

@ -1174,17 +1174,6 @@ export const EnvInvalidVariables = {
`The following environment variables defined in \`experimental.env.schema\` are invalid:\n\n${errors.map((err) => `- ${err}`).join('\n')}\n`,
} satisfies ErrorData;
/**
* @docs
* @description
* The `astro:env/server` exported function `getSecret()` is not supported by your adapter.
*/
export const EnvUnsupportedGetSecret = {
name: 'EnvUnsupportedGetSecret',
title: 'Unsupported astro:env getSecret',
message: '`astro:env/server` exported function `getSecret` is not supported by your adapter.',
} satisfies ErrorData;
/**
* @docs
* @description