question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

after upgrade to ^3.0.0-rc.32", i got compilation error using CallAnApi.using(axiosInstance) (with axios 1.1.3)

See original GitHub issue

test:consent:stage] TSError: ⨯ Unable to compile TypeScript: [test:consent:stage] src/Actors.ts(18,29): error TS2345: Argument of type ‘import(“/Users/xxxxx/dev/sh-common-services-serenityjs/node_modules/axios/index”).AxiosInstance’ is not assignable to parameter of type ‘import(“/Users/xxxxxxx/dev/sh-common-services-serenityjs/node_modules/@serenity-js/rest/node_modules/axios/index”).AxiosInstance’. [test:consent:stage] The types of ‘defaults.headers.common’ are incompatible between these types. [test:consent:stage] Type ‘Partial<RawAxiosHeaders & MethodsHeaders & CommonHeaders>’ is not assignable to type ‘AxiosRequestHeaders’. [test:consent:stage] ‘string’ index signatures are incompatible. [test:consent:stage] Type ‘AxiosHeaderValue’ is not assignable to type ‘string | number | boolean’. [test:consent:stage] Type ‘AxiosHeaders’ is not assignable to type ‘string | number | boolean’. [tes

Actors.ts:

    baseURL: process.env.WEATHER_SERVICE_BASE_URL,
    timeout: 5000,
    headers: { Accept: 'application/json' },
});
export class Actors implements Cast {
    constructor(private readonly baseApiUrl: string) {
        ensure('apiUrl', baseApiUrl, isNotBlank());
    }

    prepare(actor: Actor): Actor {        
        return actor.whoCan(
            CallAnApi.using(axiosInstance),
            TakeNotes.usingAnEmptyNotepad(),
        );
    }
}

package.json

  "@cucumber/cucumber": "^8.3.1",
    "@serenity-js/assertions": "^3.0.0-rc.32",
    "@serenity-js/console-reporter": "^3.0.0-rc.32",
    "@serenity-js/core": "^3.0.0-rc.32",
    "@serenity-js/cucumber": "^3.0.0-rc.32",
    "@serenity-js/rest": "^3.0.0-rc.32",
    "@serenity-js/serenity-bdd": "^3.0.0-rc.32",
    "@types/node": "^18.0.0",
    "@typescript-eslint/eslint-plugin": "^5.29.0",
    "@typescript-eslint/parser": "^5.29.0",
    "axios": "^1.1.3",
    "axios-debug-log": "^0.8.4",
    "axios-mock-adapter": "^1.20.0",

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
viper3400commented, Oct 26, 2022

Hi @LayMui , looks like you use axios version 1.1.3, could you try to downgrade to the version serenity-js/rest is using (^0.27.2).

https://github.com/serenity-js/serenity-js/blob/3480ba44d83ff663a6a7c3e51ab1f977776cc9d0/packages/rest/package.json#L49

@jan-molak , we already had this issue, see #1223 , looks as it‘s back in axios 1.x

0reactions
LayMuicommented, Oct 29, 2022

yes @viper3400 , i agree this is a separate issue. so I will close this as resolved after change the axios version

Read more comments on GitHub >

github_iconTop Results From Across the Web

Serenity-JS/rest: Axios version issue when using an ... - GitHub
I had to adjust the timeout of my axios instance as mentioned in #1196 described in the second example here To do so,...
Read more >
data in Vue instance doesn't get updated after axios post ...
I am writing a code piece to submit the html form data on a POST REST API. Using Vue.js ...
Read more >
CallAnApi - | Serenity/JS
public static using(axiosInstance: AxiosInstance): CallAnApi source. Ability to Call a REST API using a given axios instance. Useful when you need to customise ......
Read more >
React Axios API Requests | Axios with React JS Tutorial
Learn React Axios API Requests in this tutorial. We will implement Axios with React JS as we build our React JS Blog project....
Read more >
Building a Vue 3 Application with JSON Server and Axios
Axios is the HTTP client that we will use to make HTTP requests to the JSON server. In this article, we will build...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found