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

astro:env can't find secrets in middleware #12324

Closed
1 task done
florian-lefebvre opened this issue Oct 28, 2024 · 7 comments · Fixed by #12351 · May be fixed by #12326
Closed
1 task done

astro:env can't find secrets in middleware #12324

florian-lefebvre opened this issue Oct 28, 2024 · 7 comments · Fixed by #12351 · May be fixed by #12326
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: env related to the way astro handles `.env` or `import.meta.env` or `process.env` (scope) regression

Comments

@florian-lefebvre
Copy link
Member

florian-lefebvre commented Oct 28, 2024

Astro Info

N/A

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When using a secret inside a middleware, it now fails

  1. npm run build
  2. npm run preview
  3. visit root

What's the expected result?

Should still work

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-8b8hjn

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Oct 28, 2024
@florian-lefebvre florian-lefebvre added - P4: important Violate documented behavior or significantly impacts performance (priority) regression feat: env related to the way astro handles `.env` or `import.meta.env` or `process.env` (scope) and removed needs triage Issue needs to be triaged labels Oct 28, 2024
@florian-lefebvre florian-lefebvre self-assigned this Oct 28, 2024
@JLarky
Copy link
Contributor

JLarky commented Oct 31, 2024

seeing the same issue in astro 4.16.6-4.16.8

I even tried to remove middleware/index.ts and it didn't help me, still fails here:

image image

@florian-lefebvre
Copy link
Member Author

I don't know for sure in what version it was introduced but in the meantime, downgrade a few patches until it works. We are working on a fix but it's not easy so I have no ETA atm

@JLarky
Copy link
Contributor

JLarky commented Oct 31, 2024

it works in 4.16.5

BTW I tested with astro@experimental--env-middleware and seeing exactly the same error like I saw when I removed middleware

@florian-lefebvre
Copy link
Member Author

Yeah, I tried it as well and I was very disappointed to see my attempt did not work at all :/. @ematipico is probably going to pick it up. Thanks for confirming the version where it works!

@JLarky
Copy link
Contributor

JLarky commented Nov 5, 2024

can confirm 4.16.9 works

@florian-lefebvre
Copy link
Member Author

Yeah we reverted, we're going to do another attempt this/next week

@florian-lefebvre
Copy link
Member Author

@JLarky what adapter were you using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: env related to the way astro handles `.env` or `import.meta.env` or `process.env` (scope) regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants