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

Maximum call stack size exceeded #6376

Open
jacquesearle96 opened this issue Apr 30, 2024 · 4 comments
Open

Maximum call stack size exceeded #6376

jacquesearle96 opened this issue Apr 30, 2024 · 4 comments

Comments

@jacquesearle96
Copy link

Describe the bug

I'm using Vue 3 with axios on a new project (I have used it multiple times before) and since installing and using it I am getting this "Maximum call stack size exceeded" error. I have tried multiple versions and nothing seems to fix it.

image

To Reproduce

No response

Code snippet

//axios.js file
import axios from 'axios';

const getSessionId = () => {
    return sessionStorage.sessionId;
}

const axiosIns = axios.create({
    headers: {
        'Authorization': `Bearer ${useCookie('accessToken').value}`,
        'sessionId': getSessionId()
    }
})

export default axiosIns

Expected behavior

My app loads and the API call via axios works as expected, but I don't think this error is normal and I shouldn't put this in production

Axios Version

1.6.8

Adapter Version

No response

Browser

Chrome

Browser Version

Version 124.0.6367.91 (Official Build) (64-bit)

Node.js Version

21.1.0

OS

Windows

Additional Library Versions

"vue": "3.4.21"

Additional context/Screenshots

No response

@jacquesearle96
Copy link
Author

vite: "5.2.10"

@partg952
Copy link

partg952 commented May 3, 2024

can you share the code snippet where you are making the api call?

@yeloginov
Copy link

yeloginov commented May 5, 2024

Hello!
I have the same issue. Just declaring the axios I receive the error in the console. As well as for @jacquesearle96 axios works further after the error.

My code:

main.js

...
import axios from 'axios';
import App from './components/app.js'

const app = createApp(App)
axios.defaults.baseURL = 'http://localhost:8081'
axios.defaults.responseType = 'json'

app.use(axios)
app.use(router)
app.mount('#root')

store.js

...
import axios from 'axios'

export const useLabelStore = defineStore('label', {
    state: () => {
        return {
            label: [],
        }
    },

    actions: {
      load() {
        axios
            .get('/config/language')
            .then(response => { this.label = response.data })
      },
    },
  })

Using https://unpkg.com/[email protected]/dist/esm/axios.min.js

Thanks!

@jacquesearle96
Copy link
Author

can you share the code snippet where you are making the api call?

Hi @partg952 the error doesn't only show up when I make an API call - it shows as soon as I launch the app (no API calls happen when I view the login screen).

Below is the axios.js file I inject in my store.js files I use to make API calls:
image

Below is my store.js file. import axios from '@axios' injects the above mentioned axios.js file:
image

Above @axios is defined in my vite.config.js file:

'@axios': fileURLToPath(new URL('./src/plugins/axios',
                import.meta.url)),

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