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:
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;
Error:
Franz3@DESKTOP-CCJAUN6 MINGW64 ~/VSC/qmj-atom-feed (master)
$ npm start

> qmj-atom-feed@0.0.0 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

> qmj-atom-feed@0.0.0 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"
2 Replies
Franz3
Franz35mo ago
my wrangler.toml file (adding node_compat = true didnt seem to help):
name = "qmj-atom-feed"
main = "src/index.ts"
compatibility_date = "2024-04-19"
compatibility_flags = ["nodejs_compat"]
name = "qmj-atom-feed"
main = "src/index.ts"
compatibility_date = "2024-04-19"
compatibility_flags = ["nodejs_compat"]
Resource I used to get started with cloudflare: https://youtu.be/H7Qe96fqg1M I also didnt understand yet, what the Env interface in worker-configuration.d.ts is needed/ used for
Cloudflare Workers
YouTube
Learn Cloudflare Workers - Full Course for Beginners
Learn how to build your first Cloudflare Workers application and deploy it to Cloudflare's global network. If you don’t already have an account sign up for a free Workers account today! https://workers.cloudflare.com 👨‍🏫 Hosted by Kristian Freeman, Cloudflare Developer Advocate 🔗 https://twitter.com/kristianf_ 🔗 Get Started guide for Cloudfla...
Franz3
Franz35mo ago
Whats the problem with this thread? What am I doing wrong that no one is trying to help me?
Want results from more Discord servers?
Add your server