Skip to content

🐛 BUG: globalThis.XMLHttpRequest is not a constructor #983

@ggvbo

Description

@ggvbo

What version of Wrangler are you using?

2.0.3

What operating system are you using?

Windows

Describe the Bug

Using wrangler dev results in this:

 {
    text: 'Received a bad response from the API',
    notes: [
      {
        text: 'Uncaught TypeError: globalThis.XMLHttpRequest is not a constructor\n' +
          '  at line 0\n' +
          ' [code: 10021]'
      }
    ],
    location: undefined,
    kind: 'error',
    code: 10021
  }

I'm running an TypeScript application compiled into JavaScript and using that w/node-compatibility, this is what my wrangler.toml looks like:

name = "onemiwrap"
compatibility_date = "2022-05-13"
main = "./dist/index.js"
node_compat = true

Is this expected behaviour, and if it isn't, what can I do to work around it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    node compatRelating to the differences between the Workers environment and Node

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions