-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Middleware dependencies are incorrectly bundled #10164
Comments
@danielo515, please replace the |
I am running into a separate issue (trying to
|
Does that mean that you updated some dependency? |
@ematipico The only dependency change I made yesterday was via Then this morning I tried to |
It seems that the issue is around the vercel adapter. I tried with the node adapter, and the module is correctly kept in the source code. cc @lilnasy |
As someone mentioned, I can't put the output of the command because I get an error about crypto not being defined. EDIT: Removed netlify, re-installed, astro info still fails at the vercel adapter:
|
It's possible you're running an old version of Node.js and vercel adapter, and the polyfill isn't triggered. What's your version? |
The error about I'm guessing you meant to place I see the issue with the node adapter as well. And it seems to be the same underlying bug as #8596 - rollup crudely combining user-written modules and astro naively turning the entire combined chunk into no-ops. |
My node version is |
How lucky I am 😂 can I update to 4.4.1? When was it released? my project is quite recent |
The stackblitz reproduction. |
Awesome, updating to astro 4.4 allows me to finally run astro info:
Not very useful information though, I could have told you that if you asked for my astro.config.mjs |
Oh, that is then a mistake when I made the reproduction |
Updated the reproduction to be correct @lilnasy npm build
cat .vercel/output/functions/_render.func/.vercel/output/_functions/chunks/prerender_Li4whjEZ.mjs |
For completeness, here are all my versions: dependencies:
@astrojs/check 0.5.4 @lucia-auth/adapter-postgresql 3.1.0 jose 5.2.2 tailwindcss 3.4.1
@astrojs/svelte 5.0.3 @vercel/postgres 0.7.2 lucia 3.0.1 typescript 5.3.3
@astrojs/tailwind 5.1.0 astro 4.4.1 nanoid 5.0.5
@astrojs/vercel 7.3.1 effect 2.3.6 oslo 1.1.2
@effect/schema 0.62.8 fp-ts 2.16.2 svelte 4.2.10 |
It seems the vercel adapter has some more issues. For your reference, I am reporting another problem here: |
No, that's expected. In hybrid mode, static generation is run by default, and you have to opt-out if you want to have a route that needs to run in SSR. |
But the middleware is something runtime specific, I don't see a reason to run it at build time, not even for static pages In any case, that is probably off topic for the scope of this issue, so let's keep it focused |
Are people still having this issue? Noticed that #10279 was made to address this, but the issue is still open. @danielo515 @mikenicklas ? |
I am going to assume that's closed and fixed. Fee free to open a new issue if you experience a similar issue, because we recently refactored our bundling strategy. |
Well it seems like I have similar issues related to my middleware. (Thanks for pointing me in this direction) Have been scouring the internet for a few days now, not finding any relatable problem to my issues. My middleware is used to set User session cookies, and runs fine in Dev mode, but not when building locally or in production. I also use Oslo and Lucia like Daniel, but in combination with Astro:DB to store users and sessions, both my local build as the builds on netlify choke on dependencies needed by Astro:DB when generating my SSR functions. Once I remove the Middleware file and replace my Astro.locals with data, everything builds fine. Is this issue related? Am I in the right thread? What do I do? |
@ezriharmusial as per my last comment, please open a new issue with a minimal reproduction and instructions to reproduce it. We will attempt to triage it and see how it goes. Thank you. |
Will do so. Thankyou. |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I am using a middleware to handle auth. In local dev mode, everything works as expected. However, when deployed to vercel, one of the imported constants becomes
noop
instead of being an array.To give you an idea of how it looks.
Here is the original middleware
Then, the constants files contains:
However, this is the generated middleware (part)
And this is the file where PUBLIC_ROUTES is being imported from:
What's the expected result?
I expect the constants to be inlined in the generated middleware so it can properly work
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-t5xhyw
Participation
The text was updated successfully, but these errors were encountered: