diff options
author | 2024-11-20 06:09:43 -0500 | |
---|---|---|
committer | 2024-11-20 11:09:43 +0000 | |
commit | c3b7e7cfa13603c08eb923703f31a92d514e82db (patch) | |
tree | fc33996868d4bece6683e08c3620c6c8c805e3cc | |
parent | 46f6b386b3db6332f286d79958ef10261958cceb (diff) | |
download | astro-c3b7e7cfa13603c08eb923703f31a92d514e82db.tar.gz astro-c3b7e7cfa13603c08eb923703f31a92d514e82db.tar.zst astro-c3b7e7cfa13603c08eb923703f31a92d514e82db.zip |
Remove default throw behavior in astro:env (#12480)
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
-rw-r--r-- | .changeset/early-scissors-beg.md | 5 | ||||
-rw-r--r-- | packages/astro/src/core/app/pipeline.ts | 1 | ||||
-rw-r--r-- | packages/astro/src/core/base-pipeline.ts | 8 | ||||
-rw-r--r-- | packages/astro/src/core/errors/errors-data.ts | 11 |
4 files changed, 5 insertions, 20 deletions
diff --git a/.changeset/early-scissors-beg.md b/.changeset/early-scissors-beg.md new file mode 100644 index 000000000..0b3d85e43 --- /dev/null +++ b/.changeset/early-scissors-beg.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Removes the default throw behavior in `astro:env` diff --git a/packages/astro/src/core/app/pipeline.ts b/packages/astro/src/core/app/pipeline.ts index 4f753419a..f3813e12a 100644 --- a/packages/astro/src/core/app/pipeline.ts +++ b/packages/astro/src/core/app/pipeline.ts @@ -54,7 +54,6 @@ export class AppPipeline extends Pipeline { undefined, undefined, undefined, - false, defaultRoutes, ); pipeline.#manifestData = manifestData; diff --git a/packages/astro/src/core/base-pipeline.ts b/packages/astro/src/core/base-pipeline.ts index 4eeb2f052..0dcd9ac52 100644 --- a/packages/astro/src/core/base-pipeline.ts +++ b/packages/astro/src/core/base-pipeline.ts @@ -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; diff --git a/packages/astro/src/core/errors/errors-data.ts b/packages/astro/src/core/errors/errors-data.ts index e8492584a..085f52dfb 100644 --- a/packages/astro/src/core/errors/errors-data.ts +++ b/packages/astro/src/core/errors/errors-data.ts @@ -1177,17 +1177,6 @@ export const EnvInvalidVariables = { /** * @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 * This module is only available server-side. */ export const ServerOnlyModule = { |