Skip to content

flutterwave cloudflare error because of use of axios #168

@adex-codez

Description

@adex-codez

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/rollup-plugin-node-polyfills@0.2.1/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/rollup-plugin-node-polyfills@0.2.1/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/request@2.88.2/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/rollup-plugin-node-polyfills@0.2.1/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/rollup-plugin-node-polyfills@0.2.1/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/request@2.88.2/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

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