-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(CLI): Hotswap raises Invalid Arn when updating state machine definition #17716
Comments
Hi @fab-mindflow, thanks for opening the issue. Can you show your CDK code that raises this error? Thanks, |
Hi @skinny85, I can reproduce it from scratch like this:
> cdk init --language=typescript
> yarn install
> yarn add @aws-cdk/aws-stepfunctions
import * as sfn from "@aws-cdk/aws-stepfunctions"
import { WaitTime } from "@aws-cdk/aws-stepfunctions"
import * as cdk from "@aws-cdk/core"
export class CdkStack extends cdk.Stack {
public constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props)
const waitStep = new sfn.Wait(this, "Wait", {
time: WaitTime.duration(cdk.Duration.seconds(10)),
})
const succeedStep = new sfn.Succeed(this, "Start", {})
waitStep.next(succeedStep)
// const startStep = waitStep
const startStep = succeedStep
const _stateMachine = new sfn.StateMachine(this, "MyStateMachine", {
stateMachineName: "MyStateMachine",
definition: startStep,
})
}
}
const startStep = waitStep
// const startStep = succeedStep
❯ cdk deploy --hotswap
⚠️ The --hotswap flag deliberately introduces CloudFormation drift to speed up deployments
⚠️ It should only be used for development - never use it for your production Stacks!
CdkStack: deploying...
❌ CdkStack failed: InvalidArn: Invalid Arn: 'Invalid ARN prefix: MyStateMachine'
at Request.extractError (/opt/homebrew/Cellar/aws-cdk/1.134.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/protocol/json.js:52:27)
at Request.callListeners (/opt/homebrew/Cellar/aws-cdk/1.134.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/opt/homebrew/Cellar/aws-cdk/1.134.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/opt/homebrew/Cellar/aws-cdk/1.134.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:686:14)
at Request.transition (/opt/homebrew/Cellar/aws-cdk/1.134.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/opt/homebrew/Cellar/aws-cdk/1.134.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /opt/homebrew/Cellar/aws-cdk/1.134.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/opt/homebrew/Cellar/aws-cdk/1.134.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/opt/homebrew/Cellar/aws-cdk/1.134.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:688:12)
at Request.callListeners (/opt/homebrew/Cellar/aws-cdk/1.134.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
code: 'InvalidArn',
time: 2021-12-04T13:32:20.700Z,
requestId: 'b1eafc53-483f-45bd-96c1-e409945adb1c',
statusCode: 400,
retryable: false,
retryDelay: 144.62321105479253
} |
Thanks for the detailed reproduction steps @fab-mindflow! I'll let @comcalvi handle this one, as he was the original author of this functionality 🙂. |
Great, thanks ! The hotswap feature for AWS Step Functions is really key to us so we can boost our deployment pipeline. I've seen the CDK 2.0 announcement and hope that the fix can still reach the 1.x branch. |
Before, when the `stateMachineName` property was used, the value of `stateMachineName` was passed directly to the SDK where an ARN was required. Now, when the `stateMachineName` property is used, we construct the ARN from its value, and pass that ARN to the SDK. Closes #17716 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Before, when the `stateMachineName` property was used, the value of `stateMachineName` was passed directly to the SDK where an ARN was required. Now, when the `stateMachineName` property is used, we construct the ARN from its value, and pass that ARN to the SDK. Closes aws#17716 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
What is the problem?
CDK deploy with hotswap fails with
Invalid ARN prefix
error as follows when updating a state definition :This may be due to this:
aws-cdk/packages/aws-cdk/lib/api/hotswap/stepfunctions-state-machines.ts
Line 59 in 557f9c3
Reproduction Steps
Deploying with
--hotswap
a state machine in my AWS / CDK environment. A normal deploy (without hotswap) works fine.What did you expect to happen?
AWS Step Functions State machine updated successfully with hotswap.
What actually happened?
Command line failure to update AWS Step Functions state machine.
CDK CLI Version
1.134.0 (build dd5e12d)
Framework Version
No response
Node.js Version
16.13.0
OS
macOS 12.0.1 (Monterey)
Language
Typescript
Language Version
4.4.3
Other information
No response
The text was updated successfully, but these errors were encountered: