Skip to content

serverless deploy hangs with --verbose and disableRollback: true #150

@yaronya

Description

@yaronya

When deploying with both --verbose and disableRollback: true, the CLI hangs indefinitely after a CloudFormation resource fails. Without --verbose the failure is reported immediately.

This was originally reported in serverless/serverless#12770 and a fix was proposed in serverless/serverless#12772, but it was never merged upstream.

Steps to reproduce

  1. Set disableRollback: true in the provider config:
provider:
  name: aws
  disableRollback: true
  1. Deploy with --verbose:
serverless deploy --verbose
  1. Trigger any resource failure (e.g. an ApiGatewayDeployment that fails to create).

Expected behavior

The CLI should detect the failure and exit with an error, same as it does without --verbose.

Actual behavior

The CLI hangs forever. The CloudFormation stack lands in UPDATE_FAILED (or CREATE_FAILED), and because disableRollback is enabled, no rollback occurs — the stack never transitions to ROLLBACK_COMPLETE, DELETE_FAILED, or DELETE_COMPLETE.

Root cause

In lib/plugins/aws/lib/monitor-stack.js, the error-throwing condition when --verbose is active waits for a terminal status:

if (
  stackLatestError &&
  (!this.options.verbose ||
    (stackStatus &&
      (stackStatus.endsWith('ROLLBACK_COMPLETE') ||
        ['DELETE_FAILED', 'DELETE_COMPLETE'].includes(stackStatus))))
)

With disableRollback: true, the stack status stays at UPDATE_FAILED or CREATE_FAILED — neither of which matches the condition above. The monitor loop keeps polling forever.

Proposed fix

Add CREATE_FAILED and UPDATE_FAILED to the status check:

['CREATE_FAILED', 'UPDATE_FAILED', 'DELETE_FAILED', 'DELETE_COMPLETE'].includes(stackStatus)

This way the CLI exits on failure regardless of whether rollback is enabled.

Environment

  • osls 3.63.2
  • Node.js 24.x
  • macOS / Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions