question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StateMachine DefinitionUri doesn't accept local files

See original GitHub issue

Description:

Based on the official documentation the description of DefinitionUri is as follows:

DefinitionUri
The Amazon S3 URI or local file path of the state machine definition written in Amazon States Language.

If a local file path is provided, the template must go through the workflow that includes the sam deploy or sam package command, in order for the definition to be transformed properly.

One of Definition or DefinitionUri must be provided.

Type: String | S3Location

An example is even included:

MySampleStateMachine:
  Type: AWS::Serverless::StateMachine
  Properties:
    DefinitionUri: statemachine/my_state_machine.asl.json
    Role: arn:aws:iam::123456123456:role/service-role/my-sample-role
    DefinitionSubstitutions:
      MyFunctionArn: !GetAtt MyFunction.Arn
      MyDDBTable: !Ref TransactionTable

However, local files do not seem to be actually supported (by brief look at the feature commits) and using it results in Resource is invalid. 'DefinitionUri' is not a valid S3 Uri of the form 's3://bucket/key' with optional versionId query parameter. error message.

Having the StateMachine definition in a separate local file (possibly JSON definition and YML template) would be most useful, unlike linking separately uploaded S3 file.

Steps to reproduce the issue:

  1. Use AWS::Serverless::StateMachine resource.
  2. Define a local path as it’s DefinitionUri.

Observed result: Resource is invalid. ‘DefinitionUri’ is not a valid S3 Uri of the form ‘s3://bucket/key’ with optional versionId query parameter.

Expected result: Successful deployment.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
aaronleleviercommented, Mar 5, 2021

Ok Type: AWS::StepFunctions::StateMachine should be Type: AWS::Serverless::StateMachine.

They are different. The first is the Cloudformation type, the second is the SAM type.

1reaction
aaronleleviercommented, Mar 5, 2021

I don’t have this error any more. And it’s now an allowed key. Maybe it’s something else. I’m on the same SAM version 1.13.2 SAM CLI

https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-statemachine.html

Read more comments on GitHub >

github_iconTop Results From Across the Web

StateMachine DefinitionUri doesn't accept local files #2027
Use AWS::Serverless::StateMachine resource. Define a local path as it's DefinitionUri . Observed result: Resource is invalid. 'DefinitionUri' is ...
Read more >
AWS::Serverless::StateMachine
DefinitionUri. The Amazon Simple Storage Service (Amazon S3) URI or local file path of the state machine definition written in the Amazon States...
Read more >
aws cloudformation package transforms some local paths to ...
I am using Codebuild to handle the transformation, and here is the buildspec.yml file when I was having the state machine DefinitionUri ......
Read more >
Using the AWS Serverless Application Model (SAM)
Locally the build may skip recompilation if nothing has changed or copy files and retaining their timestamps; but when using a fresh checkout...
Read more >
Serverless Step Functions - Serverless Framework: Plugins
Sample statemachines setting in serverless.yml ... to know how the Serverless framework converts these local names to CloudFormation logical ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found