Closed lowintechie closed 3 months ago
Please update the template and provide the information of astro info
.
Please provide a valid reproduction. Your reproduction doesn't have a middleware, where you should populate your runtime object.
Hello @lowinn. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro
will be closed if they have no activity within 3 days.
Please update the template and provide the information of
astro info
.Please provide a valid reproduction. Your reproduction doesn't have a middleware, where you should populate your runtime object.
I already updated please check
@lowinn the reproduction is incorrect, because you aren't creating any runtime object
Where do you expect to get that value? Have you read some documentation somewhere? Please share as much information as possible, because I am not really sure what you're doing.
@lowinn the reproduction is incorrect, because you are creating any runtime object
Where do you expect to get that value? Have you read some documentation somewhere? Please share as much information as possible, because I am really sure what you're doing.
I'm unsure how to provide more information to assist you in helping me resolve this issue quickly. Could you suggest where else I might look for a solution?
Ah, I see. You haven't installed the Cloudflare adapter:)
Ah, I see. You haven't installed the Cloudflare adapter:)
I'm done
import cloudflare from "@astrojs/cloudflare";
// https://astro.build/config
export default defineConfig({
output: "server",
adapter: cloudflare()
});
is needed to actually enable the cloudflare adapter
import cloudflare from "@astrojs/cloudflare"; // https://astro.build/config export default defineConfig({ output: "server", adapter: cloudflare() });
is needed to actually enable the cloudflare adapter
I already added dear @OliverSpeir
Ah I didn't see that in the stackblitz, so the issue persists?
Can you give exact steps to recreate with a repo? I'm assuming the stackblitz won't work due to needing to use wrangler dev
Thanks for your patience, we appreciate you taking the time to sort this out
Ah I didn't see that in the stackblitz, so the issue persists?
Can you give exact steps to recreate with a repo? I'm assuming the stackblitz won't work due to needing to use wrangler dev
Thanks for your patience, we appreciate you taking the time to sort this out
@OliverSpeir You can check here : https://stackblitz.com/edit/withastro-astro-babntn?file=src%2Fpages%2Findex.astro
@lowinn you need to enable the support for astro dev
manually. It will be enabled by default with the next major version.
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';
export default defineConfig({
output: 'server',
+ adapter: cloudflare({
+ platformProxy: {
+ enabled: true
+ }
+ }),
});
@lowinn you need to enable the support for
astro dev
manually. It will be enabled by default with the next major version.import { defineConfig } from 'astro/config'; import cloudflare from '@astrojs/cloudflare'; export default defineConfig({ output: 'server', + adapter: cloudflare({ + platformProxy: { + enabled: true + } + }), });
@alexanderniebuhr @ematipico @OliverSpeir Thank you guys it's work now.
Astro Info
Integrations: [tailwind, sitemap, sanity, sentry, react, mdx, AstroPWA]
Middleware code :
`export function GET(context) { const runtime = context.locals.runtime;
return new Response('Some body'); }`
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When attempting to destructure the 'env' property from the 'Astro2.locals.runtime' object, an error occurs stating that the property is undefined. This prevents the expected behavior of the code and hinders its functionality.
What's the expected result?
The 'env' property should be properly defined within the 'Astro2.locals.runtime' object and should be successfully destructured without encountering any errors.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-4gxv2t?file=src%2Fpages%2Findex.astro
Participation