Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove default throw behavior in astro:env #12480

Merged
merged 5 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/early-scissors-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Remove default throw behavior in astro:env
ematipico marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion packages/astro/src/core/app/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export class AppPipeline extends Pipeline {
undefined,
undefined,
undefined,
false,
defaultRoutes,
);
pipeline.#manifestData = manifestData;
Expand Down
8 changes: 0 additions & 8 deletions packages/astro/src/core/base-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
11 changes: 0 additions & 11 deletions packages/astro/src/core/errors/errors-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading