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

Angular 12 error: gocardless is not a function #113

Open
tigerdi opened this issue Jan 26, 2022 · 2 comments
Open

Angular 12 error: gocardless is not a function #113

tigerdi opened this issue Jan 26, 2022 · 2 comments

Comments

@tigerdi
Copy link

tigerdi commented Jan 26, 2022

Trying to use this API on an Angular 12 app, following the instructions.

Importing the module as follows:

const gocardless = require('gocardless-nodejs');
const constants = require("gocardless-nodejs/constants");

Then trying to create the client:

const client = gocardless(
    [gcAccessToken],
    // Change this to constants.Environments.Live when you're ready to go live
    constants.Environments.Sandbox
);

but keeps showing this error:
ERROR TypeError: gocardless is not a function

Here are the dependencies of my app:

"dependencies": {
        "@angular-material-components/file-input": "^6.0.0",
        "@angular/animations": "12.2.3",
        "@angular/cdk": "12.2.3",
        "@angular/cli": "12.2.3",
        "@angular/common": "12.2.3",
        "@angular/compiler": "12.2.3",
        "@angular/compiler-cli": "12.2.3",
        "@angular/core": "12.2.3",
        "@angular/forms": "12.2.3",
        "@angular/material": "12.2.3",
        "@angular/material-moment-adapter": "12.2.3",
        "@angular/platform-browser": "12.2.3",
        "@angular/platform-browser-dynamic": "12.2.3",
        "@angular/router": "12.2.3",
        "@capacitor/android": "^3.3.3",
        "@capacitor/core": "^3.3.3",
        "@capacitor/ios": "^3.3.3",
        "@capacitor/push-notifications": "^1.0.9",
        "@fullcalendar/angular": "4.4.5-beta",
        "@fullcalendar/core": "^4.4.2",
        "@fullcalendar/daygrid": "4.4.2",
        "@fullcalendar/interaction": "4.4.2",
        "@fullcalendar/list": "4.4.2",
        "@fullcalendar/moment": "4.4.2",
        "@fullcalendar/resource-timegrid": "4.4.2",
        "@fullcalendar/resource-timeline": "4.4.2",
        "@fullcalendar/rrule": "4.4.2",
        "@fullcalendar/timegrid": "4.4.2",
        "@ngneat/transloco": "2.22.0",
        "apexcharts": "3.28.1",
        "assert": "^2.0.0",
        "aws-sdk": "^2.1060.0",
        "crypto-browserify": "^3.12.0",
        "crypto-js": "3.3.0",
        "express": "^4.17.1",
        "gocardless-nodejs": "^2.3.0",
        "highlight.js": "11.2.0",
        "https-browserify": "^1.0.0",
        "lodash-es": "4.17.21",
        "moment": "2.29.1",
        "ng-apexcharts": "1.5.12",
        "ngx-color-picker": "^11.0.0",
        "ngx-markdown": "12.0.1",
        "ngx-quill": "14.3.0",
        "os-browserify": "^0.3.0",
        "perfect-scrollbar": "1.5.2",
        "quill": "1.3.7",
        "rrule": "2.6.8",
        "rxjs": "6.6.7",
        "stream": "0.0.2",
        "stream-browserify": "^3.0.0",
        "stream-http": "^3.2.0",
        "tslib": "2.3.1",
        "util": "^0.12.4",
        "web-animations-js": "2.3.2",
        "zone.js": "0.11.4"
    },
    "devDependencies": {
        "@angular-builders/custom-webpack": "^12.0.0",
        "@angular-devkit/build-angular": "12.2.3",
        "@angular-eslint/builder": "12.3.1",
        "@angular-eslint/eslint-plugin": "12.3.1",
        "@angular-eslint/eslint-plugin-template": "12.3.1",
        "@angular-eslint/schematics": "12.3.1",
        "@angular-eslint/template-parser": "12.3.1",
        "@angular/cli": "12.2.3",
        "@angular/compiler-cli": "12.2.3",
        "@capacitor/cli": "^3.3.3",
        "@tailwindcss/aspect-ratio": "0.2.1",
        "@tailwindcss/line-clamp": "0.2.1",
        "@tailwindcss/typography": "0.4.1",
        "@types/chroma-js": "2.1.3",
        "@types/crypto-js": "3.1.47",
        "@types/highlight.js": "10.1.0",
        "@types/jasmine": "3.8.2",
        "@types/lodash": "4.14.172",
        "@types/lodash-es": "4.17.4",
        "@types/node": "^12.20.21",
        "@typescript-eslint/eslint-plugin": "4.30.0",
        "@typescript-eslint/parser": "4.30.0",
        "autoprefixer": "10.3.3",
        "chroma-js": "2.1.2",
        "eslint": "7.32.0",
        "eslint-plugin-import": "2.24.2",
        "eslint-plugin-jsdoc": "36.0.8",
        "eslint-plugin-prefer-arrow": "1.2.3",
        "jasmine-core": "3.8.0",
        "karma": "6.3.4",
        "karma-chrome-launcher": "3.1.0",
        "karma-coverage": "2.0.3",
        "karma-jasmine": "4.0.1",
        "karma-jasmine-html-reporter": "1.7.0",
        "lodash": "4.17.21",
        "postcss": "8.3.6",
        "tailwindcss": "2.2.9",
        "typescript": "4.3.5"
    }
@mauricedoepke
Copy link

mauricedoepke commented Dec 9, 2022

The way they explain it in the docs seems broken. You can use this way however to make it work:

import { Environments } from "gocardless-nodejs/constants";
import { GoCardlessClient } from "gocardless-nodejs/client";
const client = new GoCardlessClient("your_access_token_here", Environments.Sandbox);

@matteusbarbosa
Copy link

@mauricedoepke It works for NestJS too. thanks for helping!

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

3 participants