You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uncaught TypeError: globalThis.XMLHttpRequest is not a
constructor
when running the Cloudflare CLI wrangler publish.
The reason that this fails is because the cloudflare worker V8 runtime environment does not support XMLHttpRequest. It only supports fetch.
I think that the source of the dependency between the Alpaca library and XMLHttpRequest is the Axios library.
Perhaps Alpaca can check for the existence of the fetch global and fall back to axios for IE support.
Expected Behavior
Importing the Alpaca package into a cloudflare worker’s code does not cause wrangler publish to fail.
SDK Version I encountered this issue in
2.16.1
Steps To Reproduce
1. Create a cloudflare account
2. Set up a cloudflare worker with a custom build script that bundles the worker’s dependencies
3. Set node_compat = true in the the worker’s wrangler.toml configuration file to enable polyfills for node builtins
4. Install the alpaca library with npm or yarn
5. Import alpaca into the worker’s code
6. Run wrangler publish
Filled out the Steps to Reproduce section?
I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Current Behavior
import Alpaca from '@alpacahq/alpaca-trade-api';
Inside of a cloudflare worker’s code fails with:
when running the Cloudflare CLI
wrangler publish
.The reason that this fails is because the cloudflare worker V8 runtime environment does not support
XMLHttpRequest
. It only supportsfetch
.I think that the source of the dependency between the Alpaca library and
XMLHttpRequest
is the Axios library.Perhaps Alpaca can check for the existence of the fetch global and fall back to axios for IE support.
Expected Behavior
Importing the Alpaca package into a cloudflare worker’s code does not cause
wrangler publish
to fail.SDK Version I encountered this issue in
2.16.1
Steps To Reproduce
Filled out the Steps to Reproduce section?
Anything else?
No response
The text was updated successfully, but these errors were encountered: