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

bug: cloudflare-worker deploy sqlite error #32

Open
1 of 3 tasks
janowakps opened this issue Jan 20, 2025 · 1 comment
Open
1 of 3 tasks

bug: cloudflare-worker deploy sqlite error #32

janowakps opened this issue Jan 20, 2025 · 1 comment
Labels
bug Something isn't working workaround available

Comments

@janowakps
Copy link

Checklist

  • I have checked open and closed issues

Deployment Method

Cloudflare Workers

Addon Version

1.8.4

Bug Area

Build Proces

Device/Browser/OS/Stremio Version

No response

Bug Description / Steps to Reproduce

PS C:\Users\Administrator\AIOStreams> npm run deploy:cloudflare-worker

> [email protected] deploy:cloudflare-worker
> npm -w packages/cloudflare-worker run deploy


> @aiostreams/[email protected] deploy
> wrangler deploy


Cloudflare collects anonymous telemetry about your usage of Wrangler. Learn more at https://github.com/cloudflare/workers-sdk/tree/main/packages/wrangler/telemetry.md

 ⛅️ wrangler 3.100.0 (update available 3.103.2)
---------------------------------------------------------


X [ERROR] Build failed with 1 error:

  X [ERROR] Could not resolve "node:sqlite"

      ../../node_modules/undici/lib/cache/sqlite-cache-store.js:106:29:
        106 │       DatabaseSync = require('node:sqlite').DatabaseSync
            ╵                              ~~~~~~~~~~~~~

    You can mark the path "node:sqlite" as external to exclude it from the bundle, which will remove
  this error. You can also surround this "require" call with a try/catch block to handle this
  failure at run-time instead of bundle-time.




🪵  Logs were written to "C:\Users\Administrator\AppData\Roaming\xdg.config\.wrangler\logs\wrangler-2025-01-20_00-40-49_403.log"
npm ERR! Lifecycle script `deploy` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: @aiostreams/[email protected]
npm ERR!   at location: C:\Users\Administrator\AIOStreams\packages\cloudflare-worker

Expected Behavior

No response

Screenshots

No response

Debugging Checklist

  • If applicable, I have included server logs
  • If applicable, I have included MediaFlow logs
@janowakps janowakps added the bug Something isn't working label Jan 20, 2025
@Viren070
Copy link
Owner

Viren070 commented Jan 20, 2025

This is because I added a dependency, undicii which uses node:sqlite which I assume isn't supported by cloudflare workers.

I didn't find an easy solution, but here is what you can do

Warning

Note that this means the ADDON_PROXY and ADDON_PROXY_CONFIG environment variables and usage within the code will not have any affect.

  1. Remove this line from packages/wrappers/base.ts in the src folder
  2. Replace where it says uFetch with fetch at this line
  3. Remove this line

Depending on which method you are using for Cloudflare Workers, expand the relevant section.

Method 1
  1. Now that the code has been edited, your deployment on the Cloudflare Workers dashboard should succeed.
Method 2
  1. Build the wrappers package again (or the entire project if you haven't done so already)
    npm -w packages/wrappers run build
  2. Deploy again
    npm run deploy:cloudflare-worker
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working workaround available
Projects
None yet
Development

No branches or pull requests

2 participants