Skip to content

1.1.3 probably broken #5130

Closed
Closed

Description

@KartikeSingh

Describe the bug

I think there are issues is exporting the axios object and also a issue when in get function when in the instance of Axios class.

To Reproduce

Install

  • Axios V1.1.3
  • Node v18.4.0

Code snippet

const { Axios, default: a } = require('axios');

const ax = new Axios();

a.get("https://www.eldorado.gg/buy-wow-gold/g/0-0-0").then(x => console.log(x.data))

ax.get("https://www.eldorado.gg/buy-wow-gold/g/0-0-0").then(x => console.log(x.data))

Expected behavior

This code should have logged the data (html) from that url.
Mainly the issue is that default export is undefined.

Axios Version

>1.1.0

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

18.4.0

OS

Windows 10

Additional Library Versions

No response

Additional context/Screenshots

There were bugs like
1. In default export, that is undefined. [Image](https://media.discordapp.net/attachments/723104565708324915/1031017046743461928/unknown.png)

2. `Axios`'s instance's get function have a bug as well. [Image](https://media.discordapp.net/attachments/723104565708324915/1031017137382363336/unknown.png)

I tested old versions and for me version `1.1.0` and earlier versions are working fine.

Activity

  1. chrisskalog commented on Oct 16, 2022

    @chrisskalog

    Still problems with this in typescript. Using version 1.1.3

    TypeError: Cannot read properties of undefined (reading 'get')

  2. fiki574 commented on Oct 17, 2022

    @fiki574

    I can't believe that this is an on-going problem for over a full week already.

    Using v1.1.3, which is still broken, this doesn't work as well:

    import axios from "axios";
    TypeError: Cannot read properties of undefined (reading 'get')

  3. jasonsaayman commented on Oct 17, 2022

    @jasonsaayman
    Member

    For this use import { Axios } from 'axios';

  4. Zighy commented on Oct 17, 2022

    @Zighy

    Node v10.24.0 => Axios version 1.1.3 or 1.1.0

    With :
    const axios = require('axios');

    or

    const axios = require('axios').Axios;

    There's something fundamentally broken on this main version :

    import axios from './lib/axios.js';
    _____^^^^^

    SyntaxError: Unexpected identifier
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)

  5. ralphtheninja commented on Oct 17, 2022

    @ralphtheninja

    @Zighy You're using an old version of node.

  6. Zighy commented on Oct 17, 2022

    @Zighy

    @Zighy You're using an old version of node.

    What is the minimum supported version of Node ?

  7. ralphtheninja commented on Oct 17, 2022

    @ralphtheninja

    @Zighy I can't speak officially for axios, but a quick test seems to say that node v12 should do the trick, but v12 has passed end of life date as well.

  8. KartikeSingh commented on Oct 17, 2022

    @KartikeSingh
    Author

    @ralphtheninja I am using v18, but the default export is not working for me.
    And for using the axios class itself, I did used it but its get function was throwing some issue.
    So for now I am just using a old version.

  9. ralphtheninja commented on Oct 17, 2022

    @ralphtheninja

    @KartikeSingh Have you tried the following with axios 1.1.3 (in node)?

    const axios = require('axios')
    axios.get(/* .. */)
  10. ralphtheninja commented on Oct 17, 2022

    @ralphtheninja

    I can just give some background on how we're using axios. It's part of a custom module that we use in-house that's being used by both node and the browser (react). The following seems to work well for both node and the browser:

    const AXIOS = require('axios')
    const axios = AXIOS.default || AXIOS
    axios.get(/* .. */)

    Hope this helps.

  11. KartikeSingh commented on Oct 17, 2022

    @KartikeSingh
    Author

    hmm I see, seems like default is broken for node, I will try using const axios = require('axios');

    Edit:
    yes the above method words, So I think they need to fix their typings.

  12. chrisskalog commented on Oct 17, 2022

    @chrisskalog

    Yes it is a typings problem, would be nice if someone could fix it so that we can start using the latest version

  13. jcurlier commented on Oct 21, 2022

    @jcurlier

    +1

  14. jasonsaayman commented on Oct 24, 2022

    @jasonsaayman
    Member

    Will be doing another release this week. Apologies for this not being very smooth, seems the upgrade to ESM was a lot rockier than previously expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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