Uncaught ReferenceError: window is not defined

I am getting below error when I’m trying to publish my code using wrangler publish:

Error: Something went wrong with the request to Cloudflare…

Uncaught ReferenceError: window is not defined

window is only available for JavaScript running in the browser. It is not available for server-side (Node) scripts, including Cloudflare’s V8 isolates.

I am getting this error when I am trying to import an API. I am not using window variable in my index.js code. Could you help me in resolving this ?

Look in the library that you’re importing then - your code is running in a server-side context, like Node, not in a user’s browser so window will never be available.

@virendra.panwar.dhem If you’re not using the window object at all in your “self-hosted” javascript, then I agree with @KianNH who suggested that you inspect all libraries you’re using.

Yes… I found it.
You have any idea how I can create image object directly in index.js ? (Without using document)