-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
needs responseIssue needs response from OPIssue needs response from OP
Description
Astro Info
Astro v5.14.5
Vite v6.4.0
Node v22.19.0
System Linux (x64)
Package Manager npm
Output static
Adapter @astrojs/cloudflare (v12.6.10)
Integrations @astrojs/mdx (v4.3.7)
@astrojs/sitemap (v3.6.0)
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
i followed the cloudflare integration guide, the workerEntryPoint part. it's not working.
the project is created by 'pnpm create cloudflare@latest --platform=pages' command.
i simply changed the src/worker.ts, it throws error, but nothing happend.
import type { SSRManifest } from 'astro';
import { App } from 'astro/app';
import { handle } from '@astrojs/cloudflare/handler'
import { DurableObject } from 'cloudflare:workers';
class MyDurableObject extends DurableObject<Env> {
constructor(ctx: DurableObjectState, env: Env) {
super(ctx, env)
}
}
export function createExports(manifest: SSRManifest) {
throw 'aaa';
const app = new App(manifest);
return {
default: {
async fetch(request, env, ctx) {
return handle(manifest, app, request, env, ctx);
},
async queue(batch, _env) {
let messages = JSON.stringify(batch.messages);
console.log(`consumed from our queue: ${messages}`);
}
} satisfies ExportedHandler<Env>,
MyDurableObject: MyDurableObject,
}
}
the astro.config.mjs
// @ts-check
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';
// https://astro.build/config
export default defineConfig({
site: 'https://example.com',
integrations: [mdx(), sitemap()],
adapter: cloudflare({
workerEntryPoint: {
path: 'src/worker.ts',
namedExports: ['MyDurableObject']
},
platformProxy: {
enabled: true
},
imageService: "cloudflare"
}),
});
What's the expected result?
the code in worker.ts should affect the pnpm dev
command result, but it's not.
Link to Minimal Reproducible Example
https://github-wj8trigk.stackblitz.io
Participation
- I am willing to submit a pull request for this issue.
Metadata
Metadata
Assignees
Labels
needs responseIssue needs response from OPIssue needs response from OP