Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloudflare Workers/Pages adapter doesn't work with Flydrive #13005

Open
svelterust opened this issue Nov 15, 2024 · 4 comments · Fixed by #13132 · May be fixed by #13634 or #13427
Open

Cloudflare Workers/Pages adapter doesn't work with Flydrive #13005

svelterust opened this issue Nov 15, 2024 · 4 comments · Fixed by #13132 · May be fixed by #13634 or #13427

Comments

@svelterust
Copy link

Describe the bug

I'm trying to use Flydrive with SvelteKit using the any of the Cloudflare adapters but none of them work. The same imports work with Hono, so I'm guessing there's something going on here.

My goal is to use local filesystem while developing, then in production use S3 so that it works with Cloudflare Pages.

Reproduction

https://github.com/svelterust/flydrive-pages

bun install
bun run build

Logs

> Using @sveltejs/adapter-cloudflare
✘ [ERROR] Could not resolve "node:url"

    node_modules/@poppinss/utils/build/index.js:21:48:
      21 │ import { fileURLToPath as fileURLToPath3 } from "node:url";~~~~~~~~~~

  Cannot use "node:url" when deploying to Cloudflare.


✘ [ERROR] Could not resolve "node:fs/promises"

    node_modules/@poppinss/utils/build/index.js:122:30:
      122 │ import { readdir, stat } from "node:fs/promises";~~~~~~~~~~~~~~~~~~

  Cannot use "node:fs/promises" when deploying to Cloudflare.


✘ [ERROR] Could not resolve "fs"

    node_modules/etag/index.js:22:20:
      22 │ var Stats = require('fs').Stats
         ╵                     ~~~~

  Cannot use "fs" when deploying to Cloudflare.


### System Info

```Shell
~ ❯ bunx envinfo --system --binaries --browsers --npmPackages "{svelte,@sveltejs/*,vite}"

  System:
    OS: Linux 6.6 NixOS 24.11 (Vicuna) 24.11 (Vicuna)
    CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13900K
    Memory: 9.42 GB / 15.43 GB
    Container: Yes
    Shell: 5.2.32 - /run/current-system/sw/bin/bash
  Binaries:
    Node: 22.9.0 - ~/.nix-profile/bin/node
    Yarn: 1.22.22 - ~/.nix-profile/bin/yarn
    npm: 10.8.3 - ~/.nix-profile/bin/npm
    bun: 1.1.31 - ~/.nix-profile/bin/bun


### Severity

annoyance

### Additional Information

_No response_
@svelterust
Copy link
Author

I've tried to enable node_compat in wrangler.toml on previous projects, but it doesn't seem to affect the Vite build.

@eltigerchino
Copy link
Member

I'm unable to reproduce the issue after downloading the repository, installing, and building it. Please provide another minimal reproduction.

@svelterust
Copy link
Author

I'm unable to reproduce the issue after downloading the repository, installing, and building it. Please provide another minimal reproduction.

https://github.com/svelterust/flydrive-pages

Hey, I changed to another package. The same issue is occuring, but during runtime instead.

I talked to the developer of Flystorage, the new package I'm using because it only had one error and that was during runtime. Here's the conversation: duna-oss/flystorage#82

flydrive-pages ❯ bunx wrangler pages deployment tail

 ⛅️ wrangler 3.94.0
-------------------

✔ Select a project: › drive
No deployment specified. Using latest deployment for production environment.
Connected to deployment cb3ca932-b019-4ef8-89f7-2e8cdac3c976, waiting for logs...
GET https://drive-6r2.pages.dev/ - Ok @ 12/10/2024, 3:46:34 PM
  (error) Error: Dynamic require of "node:path" is not supported
GET https://drive-6r2.pages.dev/ - Ok @ 12/10/2024, 3:46:36 PM
  (error) Error: Dynamic require of "node:path" is not supported
GET https://drive-6r2.pages.dev/favicon.ico - Ok @ 12/10/2024, 3:46:36 PM
  (error) Error: Not found: /favicon.ico

It's working with regular workers now, so seems like it's an adapter/bundling issue now.

@eltigerchino
Copy link
Member

eltigerchino commented Dec 27, 2024

We're still bundling in the Cloudflare workers adapter until #13072 is merged. Maybe we can separate that and the Workers Static Assets change into different PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment