cloudflare / cloudflare-docs

Cloudflare’s documentation
https://developers.cloudflare.com
Creative Commons Attribution 4.0 International
2.92k stars 3.31k forks source link

Document is not defined #15927

Closed Bobetti closed 1 month ago

Bobetti commented 1 month ago

Example URL(s)

localhost

Actual Behavior

Can’t start the cloudflare worker on local machine: getting Uncaught ReferenceError: document is not defined.

I’m developing cloudflare worker which will be interacting with Azure Tables SDK: https://learn.microsoft.com/en-us/javascript/api/overview/azure/data-tables-readme?view=azure-node-latest

I’m using honojs and typescript. It's definately has nothing to do with honojs. Tried the same library on vercel - and everything is working.

In order to connect to Azure Cosmos DB Table API I need to create table client: const tableClient = TableClient.fromConnectionString(this.db_connection_string, this.db_tabel_name);

After adding this code, cloudflare worker can’t start on a local machine after calling ‘npm run dev’ and throws the error: [ERROR] service core:user:electro-backend: Uncaught ReferenceError: document is not defined

image

image

What’s happening here?

Appreciate the help.

Expected Behavior

No errors

Additional information

No response

kodster28 commented 1 month ago

Howdy @Bobetti, this isn't exactly a support forum (more a space for feedback on our docs).

Your best bet might be reaching out in the Cloudflare Discord.