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

Option has no retries #97

Open
ghost opened this issue Sep 23, 2022 · 5 comments
Open

Option has no retries #97

ghost opened this issue Sep 23, 2022 · 5 comments

Comments

@ghost
Copy link

ghost commented Sep 23, 2022

I haven't followed the details of whether the type of @types/retry has changed, but I got an error that option has no "retries", and I couldn't use this package.

const retry = require('async-retry');
const fetch = require('node-fetch');

await retry(
  async (bail) => {
    // if anything throws, we retry
    const res = await fetch('https://google.com');

    if (403 === res.status) {
      // don't retry upon 403
      bail(new Error('Unauthorized'));
      return;
    }

    const data = await res.text();
    return data.substr(0, 500);
  },
  {
   // Not Found
    retries: 5,
  }
);
@mattsputnikdigital
Copy link

Im having this issue as well.

@mattsputnikdigital
Copy link

@yogarasu are you using Typescript 3 or 4. I had this issue when using the latest version of the types package on TS3.

Fix the @types package at 1.3.0 and the issue may also go away.

@eXigentCoder
Copy link

eXigentCoder commented Oct 24, 2022

Can confirm that npm i -D @types/[email protected] works, the latest version of the types definition has this code:

import { WrapOptions } from 'retry';

But the version of @types/retry that got automatically downloaded didn't have that (I'm using [email protected]).

Managed to fix it by running npm i -D @types/retry@latest @types/async-retry@latest

@ymansurozer
Copy link

Installing @types/retry solved it for me.

@vitaly-t
Copy link

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

4 participants