async-retry icon indicating copy to clipboard operation
async-retry copied to clipboard

Option has no retries

Open ghost opened this issue 3 years ago • 5 comments
trafficstars

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,
  }
);

ghost avatar Sep 23 '22 16:09 ghost

Im having this issue as well.

mattsputnikdigital avatar Oct 04 '22 12:10 mattsputnikdigital

@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.

mattsputnikdigital avatar Oct 05 '22 19:10 mattsputnikdigital

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

eXigentCoder avatar Oct 24 '22 06:10 eXigentCoder

Installing @types/retry solved it for me.

ymansurozer avatar Jun 28 '23 20:06 ymansurozer