Franz3
Explore posts from serversCDCloudflare Developers
•Created by Franz3 on 4/21/2024 in #workers-help
Serve atom feed with cloudflare error (Faild to build)
Hey, I want to serve an atom feed over cloudflare and got recommended to use hono with it. Sadly, I have come across an error when trying to build my project and I cant find a solution to it, sorry.
My code:
Error:
import { Hono } from "hono";
import { testFeed } from "./createRssFeed";
const app = new Hono();
app.get("/", async content => {
content.header("Content-Type", "application/atom+xml");
content.header("Cache-Control", "no-cache");
const feed = testFeed();
return content.body(feed);
});
export default app;
import { Hono } from "hono";
import { testFeed } from "./createRssFeed";
const app = new Hono();
app.get("/", async content => {
content.header("Content-Type", "application/atom+xml");
content.header("Cache-Control", "no-cache");
const feed = testFeed();
return content.body(feed);
});
export default app;
Franz3@DESKTOP-CCJAUN6 MINGW64 ~/VSC/qmj-atom-feed (master)
$ npm start
> [email protected] start
> wrangler dev
⛅️ wrangler 3.51.2
-------------------
[wrangler:inf] Ready on http://127.0.0.1:8787
X [ERROR] Could not resolve "string_decoder"
node_modules/sax/lib/sax.js:234:25:
234 │ var SD = require('string_decoder').StringDecoder
╵ ~~~~~~~~~~~~~~~~
The package "string_decoder" wasn't found on the file system but is built into node.
Add "node_compat = true" to your wrangler.toml file and make sure to prefix the module name with "node:" to enable Node.js compatibility.
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ [b] open a browser, [d] open Devtools, [l] turn off local mode, [c] clear console, [x] to exit │╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
X [ERROR] Failed to build
🪵 Logs were written to "C:\Users\Franz3\AppData\Roaming\xdg.config\.wrangler\logs\wrangler-2024-04 -21_20-16-49_195.log"
Franz3@DESKTOP-CCJAUN6 MINGW64 ~/VSC/qmj-atom-feed (master)
$ npm start
> [email protected] start
> wrangler dev
⛅️ wrangler 3.51.2
-------------------
[wrangler:inf] Ready on http://127.0.0.1:8787
X [ERROR] Could not resolve "string_decoder"
node_modules/sax/lib/sax.js:234:25:
234 │ var SD = require('string_decoder').StringDecoder
╵ ~~~~~~~~~~~~~~~~
The package "string_decoder" wasn't found on the file system but is built into node.
Add "node_compat = true" to your wrangler.toml file and make sure to prefix the module name with "node:" to enable Node.js compatibility.
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ [b] open a browser, [d] open Devtools, [l] turn off local mode, [c] clear console, [x] to exit │╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
X [ERROR] Failed to build
🪵 Logs were written to "C:\Users\Franz3\AppData\Roaming\xdg.config\.wrangler\logs\wrangler-2024-04 -21_20-16-49_195.log"
3 replies