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

AxiosError.config can be undefined which is not reflected in types #4951

Open
erksch opened this issue Sep 11, 2022 · 1 comment
Open

AxiosError.config can be undefined which is not reflected in types #4951

erksch opened this issue Sep 11, 2022 · 1 comment

Comments

@erksch
Copy link

erksch commented Sep 11, 2022

Describe the bug

We encountered that the config property of AxiosError is undefined in some cases, we assume in the case of network errors. This is not reflected by the type of AxiosError.config which can lead to runtime issues and might crash your application if you try to read error.config.url for example.

To Reproduce

Create a network error where the request failed to send, retrieve error as an AxiosError and try to access one of the properties of error.config for example

error.config.url

Expected behavior

The type of AxiosError.config should say that it can be undefined.

Environment

  • Axios Version 0.27.2
  • Adapter: The one react native uses
  • Node.js Version: v16.16.0
  • OS: Linux, Ubuntu 22.04.
  • Additional Library Versions: React 18.0, React Native 0.69.4
@Legion2
Copy link

Legion2 commented Sep 12, 2022

possibly related to #4922, #4659 and #4711

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

2 participants