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

@nuxt/axios Version 5.12.2 seems to have a bug #3609

Closed
front-bae opened this issue Jan 29, 2021 · 4 comments
Closed

@nuxt/axios Version 5.12.2 seems to have a bug #3609

front-bae opened this issue Jan 29, 2021 · 4 comments

Comments

@front-bae
Copy link

Describe the bug

I created a project with nuxt and proceeded with the project.

The problem that occurred after deploying the app to azure is that when axios called api, the response was not received normally, and a timeout error occurred.

Initially, it was an infrastructure issue, so we uploaded the instance and DB specifications, but it was not resolved, and unfortunately, we modified @nuxt/axios version 5.12.5 and found it to work.

What was the issue with 5.12.2?

To Reproduce

async asyncData({ app, store }) {
    const result = await app.$repositories.webinar.findWebinarInfosForIndex();
    const noticeResult = await app.$repositories.board.findNoticesIndex();
    const mainBannersResult = await app.$repositories.banner.findMainBannersForPC();
    const importancePopupResult = await app.$repositories.popup.findImportancePopup();
    const normalPopupResult = await app.$repositories.popup.findNormalPopupForPC();
    const isLiveOnResult = await app.$repositories.webinar.findWebinarLive();
    // const partnersResult = await app.$repositories.partners.findPartners();

    let webinarInfosArray = [];
    // eslint-disable-next-line no-prototype-builtins
    if (result.hasOwnProperty('status') && result.status === 200) {
      webinarInfosArray = [...result.data];
    } else {
      console.log(result);
    }

    let noticesArray = [];
    // eslint-disable-next-line no-prototype-builtins
    if (noticeResult.hasOwnProperty('status') && noticeResult.status === 200) {
      noticesArray = [...noticeResult.data];
    } else {
      console.log(result);
    }

    let mainBanners = [];
    // eslint-disable-next-line no-prototype-builtins
    if (mainBannersResult.hasOwnProperty('status') && mainBannersResult.status === 200) {
      mainBanners = [...mainBannersResult.data];
    } else {
      console.log(mainBannersResult);
    }

    let importancePopup = null;
    // eslint-disable-next-line no-prototype-builtins
    if (importancePopupResult.hasOwnProperty('status') && importancePopupResult.status === 200) {
      importancePopup = importancePopupResult.data;
    } else {
      console.log(importancePopupResult);
    }

    let normalPopup = [];
    // eslint-disable-next-line no-prototype-builtins
    if (normalPopupResult.hasOwnProperty('status') && normalPopupResult.status === 200) {
      normalPopup = [...normalPopupResult.data];
    } else {
      console.log(normalPopupResult);
    }

    // eslint-disable-next-line no-prototype-builtins
    if (isLiveOnResult.hasOwnProperty('status') && isLiveOnResult.status === 200) {
      if (isLiveOnResult.data !== '') {
        await store.dispatch('isLiveOnAction', true);
        await store.dispatch('liveWebinarInfoAction', { ...isLiveOnResult.data });
      } else {
        await store.dispatch('isLiveOnAction', false);
        await store.dispatch('liveWebinarInfoAction', null);
      }
    } else {
      console.log(isLiveOnResult);
      await store.dispatch('isLiveOnAction', false);
      await store.dispatch('liveWebinarInfoAction', null);
    }

    // let partners = [];
    // if (partnersResult.status === 200) {
    //   partners = [...partnersResult.data];
    // } else {
    //   console.log(partnersResult);
    // }

    return {
      webinarInfosArray,
      noticesArray,
      mainBanners,
      importancePopup,
      normalPopup,
      isImportancePopup: importancePopup !== null && !app.$cookies.get(CookieNames.WEBINAR_PC_IMPORTANCE_POPUP),
      isNormalPopup: normalPopup.length > 0 && !app.$cookies.get(CookieNames.WEBINAR_PC_NORMAL_POPUP),
      // partners,
    };
  },

Expected behavior

If the timeout is 0, it is correct to wait indefinitely, but I do not know why the response is not received even when 3000 is given.
After upgrading the version, the issue is working normally.

Environment

  • "@nuxtjs/axios": "^5.12.5",
  • Adapter [e.g. XHR/HTTP]
  • Browser : Chrome
  • Browser Version : chrome latest
  • Node.js Version : 14.15.1
  • OS: window 10
  • Additional Library Versions : "nuxt": "^2.14.6",

Additional context/Screenshots

Add any other context about the problem here. If applicable, add screenshots to help explain.

@chinesedfan
Copy link
Collaborator

Hi, I am afraid it's better to move to https://github.com/nuxt-community/axios-module.

@suyundukov
Copy link

Hey, @front-bae.
As it was pointed out by @chinesedfan it's not an issue related to axios.
There were some issues in @nuxt/axios@5.12.2 that were fixed in 5.12.4, see nuxt-community/axios-module#411 for more info. Hope, it will help you.

@chinesedfan
Copy link
Collaborator

Sure, closing first. And feel free to remind me if axios does something wrong.

@front-bae
Copy link
Author

I would like to express my gratitude to everyone who responded.

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