{"id":11948,"library":"retry-promise","title":"Promise Retry Utility (Bluebird-focused)","description":"The `retry-promise` package (version 1.0.0), last published in November 2015, provides a small utility function for automatically retrying promise-returning operations. It was explicitly designed to work with Bluebird Promises and implements a basic retry mechanism with configurable maximum attempts (`opts.max`) and a linear backoff strategy. The delay between retries is calculated as `attempt_number * opts.backoff`, meaning each subsequent retry waits proportionally longer. Given its age and lack of updates for nearly a decade, this package is considered abandoned. It lacks support for modern JavaScript features like native Promises or ES Modules and does not offer advanced retry strategies (e.g., jitter, custom error predicates) found in more actively maintained alternatives such as `p-retry` or `ts-retry-promise`. For new projects, developers should consider these contemporary libraries over `retry-promise`.","status":"abandoned","version":"1.0.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/olalonde/retry-promise","tags":["javascript","bluebird","promise","retry"],"install":[{"cmd":"npm install retry-promise","lang":"bash","label":"npm"},{"cmd":"yarn add retry-promise","lang":"bash","label":"yarn"},{"cmd":"pnpm add retry-promise","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"The library explicitly states it's for 'bluebird Promises' but does not list Bluebird as a direct dependency, implicitly requiring it or a compatible Promise implementation for full functionality.","package":"bluebird","optional":true}],"imports":[{"note":"This package is CommonJS-only and relies on `require()`.","symbol":"retry","correct":"const retry = require('retry-promise');"}],"quickstart":{"code":"const retry = require('retry-promise');\n\n// Mock a User model that occasionally fails to demonstrate retries\nlet creationAttempts = 0;\nconst User = {\n  forge: function(data) {\n    return {\n      createOrLoad: function() {\n        return new Promise((resolve, reject) => {\n          creationAttempts++;\n          console.log(`[Mock User] Attempt ${creationAttempts} to create user ${data.email}`);\n          if (creationAttempts < 3) { // Simulate transient failure for the first 2 attempts\n            console.log(`[Mock User] Failed attempt ${creationAttempts}`);\n            return reject(new Error('Database temporarily unavailable'));\n          } else {\n            console.log(`[Mock User] Succeeded on attempt ${creationAttempts}`);\n            return resolve({ id: 1, email: data.email });\n          }\n        });\n      }\n    };\n  }\n};\n\n// Mock Express-like req/next for a runnable example\nconst req = {};\nconst next = (err) => {\n  if (err) {\n    console.error('Middleware error:', err.message);\n  } else {\n    console.log('Middleware successful. User:', req.user);\n  }\n};\n\nconsole.log('Starting retry operation...');\nretry({ max: 3, backoff: 1000 }, function (attempt) {\n  console.log(`retry-promise callback - Attempt ${attempt}`);\n  return User\n    .forge({ email: 'test@example.com' })\n    .createOrLoad();\n})\n.then(function (user) {\n  req.user = user;\n  next();\n})\n.catch(function(error) {\n  console.error('[retry-promise] Final failure:', error.message);\n  next(error);\n});","lang":"javascript","description":"This quickstart demonstrates how to use `retry-promise` to retry a function that returns a Promise until it resolves. It includes a mock `User` service that simulates transient failures, showcasing the retry logic and linear backoff strategy."},"warnings":[{"fix":"Consider migrating to actively maintained alternatives like `p-retry` or `ts-retry-promise` for modern applications.","message":"The `retry-promise` package is effectively abandoned, with its last update occurring approximately ten years ago. It is unlikely to receive further maintenance, bug fixes, or compatibility updates for modern JavaScript environments, native Promises, or ES Modules.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure `bluebird` is installed and used if encountering unexpected Promise-related issues, or use a modern retry library that supports native Promises by default.","message":"The package explicitly targets 'bluebird Promises' but does not declare `bluebird` as a dependency. Using native JavaScript Promises or other Promise libraries directly might lead to unexpected behavior or errors if their implementations are not fully compatible with `retry-promise`'s internal workings.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Be aware of the linear backoff behavior. If exponential backoff or more sophisticated strategies (e.g., jitter, custom predicates for retrying specific errors) are required, consider alternative retry libraries.","message":"The backoff strategy is linear, calculating the delay as `attempt_number * opts.backoff`. This differs from exponential backoff strategies commonly found in modern retry libraries, which typically increase delays more aggressively to mitigate overloaded services.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure that Bluebird is being used or that the function passed to `retry` explicitly returns a Bluebird Promise. If migrating is not an option, you might need to manually adapt Bluebird into your project.","cause":"This typically occurs when `retry-promise` expects a Bluebird Promise instance, but it receives a non-callable value, possibly due to direct use of native Promises or an incompatible Promise implementation.","error":"TypeError: (intermediate value) is not a function"},{"fix":"Modify the function passed to `retry` to ensure it always returns a Promise, regardless of its execution path.","cause":"The function provided to `retry` did not return a Promise or a 'thenable' object, causing `retry-promise` to fail when attempting to chain operations.","error":"TypeError: Cannot read properties of undefined (reading 'then')"}],"ecosystem":"npm"}