Franz3
Franz3
Explore posts from servers
HHono
Created by Franz3 on 5/1/2024 in #help
Failed to load .env file ".env": Error: ENOENT: no such file or directory
Hey, Im new to using cloudflare and new to using Hono. I now came across an error that tells me Im missing a .env file, which also should contain some variables. The problem is, idk where I use these and what their values should be. It seems like these should be using system variables instead (Im currently on Windows 10), but I could find an answer online. This only started appearing after I added and tried using Hono. Here is 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;
The wrangler.toml file:
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"]
101 replies
CDCloudflare 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:
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

> 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

> 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