kalepail
kalepail
CDCloudflare Developers
Created by kalepail on 4/16/2024 in #workers-help
[ERROR] Error: No such module "chunks/pages/buffer".
I'm getting a [ERROR] Error: No such module "chunks/pages/buffer". error that I cannot for the life of me debug or source where it's coming from. My application is an Astro Pages app that definitely makes use of Buffer on the server side and I've tried bot stubbing in a buffer package as well as using compatibility_flags = [ "nodejs_compat" ] all to no avail. I cannot get past this issue when running a function that utilizes the Buffer package. Here's what my current astro.config.mjs looks like
import { defineConfig } from 'astro/config'
import cloudflare from "@astrojs/cloudflare"
import svelte from "@astrojs/svelte"
import inject from '@rollup/plugin-inject'
import tailwind from "@astrojs/tailwind"

// https://astro.build/config
export default defineConfig({
output: "server",
adapter: cloudflare({
imageService: 'passthrough',
platformProxy: {
enabled: true,
persist: true,
}
}),
vite: {
ssr: {
external: ['node:buffer']
},
build: {
rollupOptions: {
plugins: [
inject({
modules: { Buffer: ['node:buffer', 'Buffer'], }
})
],
},
},
},
integrations: [tailwind(), svelte()]
})
import { defineConfig } from 'astro/config'
import cloudflare from "@astrojs/cloudflare"
import svelte from "@astrojs/svelte"
import inject from '@rollup/plugin-inject'
import tailwind from "@astrojs/tailwind"

// https://astro.build/config
export default defineConfig({
output: "server",
adapter: cloudflare({
imageService: 'passthrough',
platformProxy: {
enabled: true,
persist: true,
}
}),
vite: {
ssr: {
external: ['node:buffer']
},
build: {
rollupOptions: {
plugins: [
inject({
modules: { Buffer: ['node:buffer', 'Buffer'], }
})
],
},
},
},
integrations: [tailwind(), svelte()]
})
3 replies