jdalrymple / gitbeaker

🦊🧪 A comprehensive and typed Gitlab SDK for Node.js, Browsers, Deno and CLI
Other
1.56k stars 295 forks source link

"AbortSignal is not defined" when trying to request. #3434

Closed Mergemat closed 1 year ago

Mergemat commented 1 year ago

Description

When I use the methods from the api, I get an error "AbortSignal is not defined". For context, i use React Ink library.

package.json:

    "name": "crpt-cli",
    "version": "0.0.0",
    "license": "MIT",
    "bin": "dist/cli.js",
    "type": "module",
    "engines": {
        "node": ">=16"
    },
    "scripts": {
        "build": "tsc",
        "dev": "tsc --watch",
        "test": "prettier --check . && xo && ava"
    },
    "files": [
        "dist"
    ],
    "dependencies": {
        "@gitbeaker/rest": "^39.20.0",
        "@inkjs/ui": "^1.0.0",
        "axios": "^1.5.1",
        "ink": "^4.1.0",
        "jira.js": "^2.20.1",
        "lodash": "^4.17.21",
        "meow": "^11.0.0",
        "react": "^18.2.0",
        "simple-git": "^3.20.0"
    },
    "devDependencies": {
        "@sindresorhus/tsconfig": "^3.0.1",
        "@types/lodash": "^4.14.199",
        "@types/node": "^20.8.7",
        "@types/react": "^18.0.32",
        "@typescript-eslint/eslint-plugin": "^6.7.5",
        "@vdemedes/prettier-config": "^2.0.1",
        "ava": "^5.2.0",
        "chalk": "^5.2.0",
        "eslint": "^8.51.0",
        "eslint-config-standard-with-typescript": "^39.1.1",
        "eslint-config-xo-react": "^0.27.0",
        "eslint-plugin-import": "^2.28.1",
        "eslint-plugin-node": "^11.1.0",
        "eslint-plugin-promise": "^6.1.1",
        "eslint-plugin-react": "^7.32.2",
        "eslint-plugin-react-hooks": "^4.6.0",
        "eslint-plugin-react-refresh": "^0.4.3",
        "ink-testing-library": "^3.0.0",
        "ts-node": "^10.9.1",
        "typescript": "^5.0.3",
        "xo": "^0.53.1"
    },
ReferenceError: AbortSignal is not defined
    at file:///Users/b.omarov/Documents/self/projects/crpt-cli/node_modules/@gitbeaker/core/dist/index.mjs:142:38
    at Branches.create (file:///Users/b.omarov/Documents/self/projects/crpt-cli/node_modules/@gitbeaker/core/dist/index.mjs:2624:32)
    at file:///Users/b.omarov/Documents/self/projects/crpt-cli/dist/modules/Branch/Branch.js:12:38
    at file:///Users/b.omarov/Documents/self/projects/crpt-cli/dist/hooks/hooks.js:9:36
    at fetchDataAndSetState (file:///Users/b.omarov/Documents/self/projects/crpt-cli/dist/hooks/hooks.js:27:19)
    at file:///Users/b.omarov/Documents/self/projects/crpt-cli/dist/hooks/hooks.js:32:9
    at commitHookEffectListMount (/Users/b.omarov/Documents/self/projects/crpt-cli/node_modules/react-reconciler/cjs/react-reconciler.development.js:14778:26)
    at commitPassiveMountOnFiber (/Users/b.omarov/Documents/self/projects/crpt-cli/node_modules/react-reconciler/cjs/react-reconciler.development.js:16609:11)
    at commitPassiveMountEffects_complete (/Users/b.omarov/Documents/self/projects/crpt-cli/node_modules/react-reconciler/cjs/react-reconciler.development.js:16569:9)
    at commitPassiveMountEffects_begin (/Users/b.omarov/Documents/self/projects/crpt-cli/node_modules/react-reconciler/cjs/react-reconciler.development.js:16556:7)

Steps to reproduce

import { Gitlab } from '@gitbeaker/rest';

const client = new Gitlab({
    host: 'https://git.crptech.ru',
    token: token,
});

const createBranch = useCallback(async () => {
    return await client.Branches.create(1603, `${prefix}/${issueKey}`, release);
}, [client.Branches, issueKey, prefix, release]);

createBranch()

Expected behaviour

The results from the api fetch are returned

Actual behaviour

The error "AbortSignal not defined" appears

Checklist

jdalrymple commented 1 year ago

Minimum supported Node version is 18+