Skip to content

document is not defined error in Cloudflare worker #129

@motss

Description

@motss

Description

The following LoC is causing an error in the wrangler action and local wrangler running the preview command.

globalThis[ID] = globalThis[ID] || {
sheet: !!document.adoptedStyleSheets
};

Expected behavior

Atomico + Astro + Cloudflare worker integration should work without any issue from build to deployment.

Actual behavior

Atomico + Astro + Cloudflare worker integration fails at the deployment step with the following error from wrangler:

✘ [ERROR] service core:user:test-astro-ts: Uncaught ReferenceError: document is not defined

    at null.<anonymous> (oi1s013v6f.js:8200:12)

Reduced test case

git clone this repo to test with local wrangler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions