Worker deployment with multiple files and a dependency


(New to Cloudflare worker)

I’m doing my first MVP with cloudflare workers and D1, locally I made several small functions to signup / login / verify a token.

Everything works perfectly locally, however when I deploy with wrangler, the worker no longer works and when I open the quick edit to see my code, my 4 files are in one and the code from the library I’m using is also in my index.js with numerous type-related errors.

The library used is “@tsndr/cloudflare-worker-jwt” and works perfectly locally.

Is there a way of deploying my separate files as they are locally?

What error you do see when accessing the Worker? If it is an exception, please stream logs from the Workers dashboard and share the output of the exceptions value.

Not really, wrangler will bundle your files together. Workers deployed with the wrangler CLI and not intended to be then edited through quick edit and this can introduce errors. You need to stick to either just quick edit or just wrangler. Given you need a third party library, likely you want wrangler.