firebase-storage-kit

Retries

Automatic retry behavior and how to customize or disable it.

Uploads retry transient failures automatically so brief network blips do not fail the whole upload. By default you get 3 retries (4 attempts total) with exponential backoff and jitter.

Default behavior

No configuration needed — retries are on by default:

const handle = manager.uploadFile(file, { path: `uploads/${file.name}` });

When a retryable error occurs, the upload status becomes retrying, then uploading again after the delay.

Listen for retries

handle.on("retry", ({ attempt, maxAttempts, delayMs, error }) => {
  console.log(`Retry ${attempt}/${maxAttempts} in ${delayMs}ms`);
  console.error(error.message);
});

Disable retries

manager.uploadFile(file, {
  path: `uploads/${file.name}`,
  retry: false,
});

Customize retry settings

manager.uploadFile(file, {
  path: `uploads/${file.name}`,
  retry: {
    maxRetries: 5,
    initialDelayMs: 700,
    maxDelayMs: 30_000,
    jitter: true,
    isRetryable: (error) => {
      // custom logic — return false to stop retrying
      return true;
    },
  },
});
OptionDefaultDescription
maxRetries3Extra attempts after the first failure
initialDelayMs1000First backoff delay
maxDelayMs30000Maximum delay between attempts
jittertrueRandomize delay to avoid thundering herd
isRetryablebuilt-inOverride which errors retry

What gets retried

Retryable (examples): storage/unknown, storage/retry-limit-exceeded, network errors without a Firebase code.

Not retryable (examples): storage/unauthorized, storage/unauthenticated, storage/quota-exceeded, storage/invalid-argument.

Permission and quota errors will not succeed on retry. Fix your Storage rules or quota instead of increasing maxRetries.

See Troubleshooting for a fuller list of error codes.

On this page