Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flutterwave cloudflare error because of use of axios #168

Open
adex-codez opened this issue Nov 27, 2024 · 0 comments
Open

flutterwave cloudflare error because of use of axios #168

adex-codez opened this issue Nov 27, 2024 · 0 comments

Comments

@adex-codez
Copy link

Have you read our Code of Conduct? By filing an Issue, you are expected to comply with it, including treating everyone with respect.

Description

I used flutterwave the way that was said is to be used on the getting started page but whenever i import it in another file containing my routes that cloudflare uses an error is thrown like so.
✘ [ERROR] service core:user:eccomerce-app: Uncaught TypeError: globalThis.XMLHttpRequest is not a constructor

at null.<anonymous> (index.js:8374:11) in checkTypeSupport
at null.<anonymous> (index.js:8397:38) in

node_modules/.pnpm/[email protected]/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/capability.js
at null. (index.js:15:56) in __init
at null. (index.js:10577:5) in
node_modules/.pnpm/[email protected]/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/request.js
at null. (index.js:15:56) in __init
at null. (index.js:10796:5) in node-modules-polyfills:http
at null. (index.js:15:56) in __init
at null. (index.js:10917:21) in
node-modules-polyfills-commonjs:http
at null. (index.js:18:50) in __require2
at null. (index.js:49449:16) in
node_modules/.pnpm/[email protected]/node_modules/request/request.js

Steps to Reproduce

  1. Instantiate flutter wave like so:
    const Flutterwave = require("flutterwave-node-v3")
    export const flw = new Flutterwave(String(process.env.FLUTTERWAVE_PUBLIC_KEY), String(process.env.FLUTTERWAVE_SECRET_KEY));
  2. import flw in the file you want to use flutterwave

Expected behaviour

No error is supposed to be thrown.

Actual behaviour

✘ [ERROR] service core:user:eccomerce-app: Uncaught TypeError: globalThis.XMLHttpRequest is not a constructor

at null.<anonymous> (index.js:8374:11) in checkTypeSupport
at null.<anonymous> (index.js:8397:38) in

node_modules/.pnpm/[email protected]/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/capability.js
at null. (index.js:15:56) in __init
at null. (index.js:10577:5) in
node_modules/.pnpm/[email protected]/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/request.js
at null. (index.js:15:56) in __init
at null. (index.js:10796:5) in node-modules-polyfills:http
at null. (index.js:15:56) in __init
at null. (index.js:10917:21) in
node-modules-polyfills-commonjs:http
at null. (index.js:18:50) in __require2
at null. (index.js:49449:16) in
node_modules/.pnpm/[email protected]/node_modules/request/request.js

Reproduces how often

everytime i use it

Configuration

  • API Version: v3
  • Environment: test mode
  • Browser:
  • Language: cloudflare-workers 3.77.0

Additional Information

To fix this replace axios with fetch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant