Search code examples
amazon-web-servicesyamlaws-sam

Add multiple parameters to path parameters AWS SAM


I have a dynamodb table that has a primary key of CompanyName and sort Key of CognitoUserID. I have a REST API and created an update method to update a user in my table. The issue I am having is that in my Yaml template I need to provide both the primary and sort key for my path parameters but I am only able to provide one. The code below is of my YAML template

    Type: AWS::Serverless::Function 
    Properties:
      CodeUri: cloudPortalFunctions/
      Handler: app.updateUserProfile
      Layers:
        - !Ref updateUserProfileDepLayer
      Runtime: nodejs14.x
      Architectures:
        - x86_64
      Events:
        
        updateUserProfile:
          Type: Api 
          Properties:
            Path: /updateUserProfile/{cognitoUserID}
            Method: PUT

This is my update method in my YAML file

I would like to be able to add CompanyName to the path. Maybe to look like this Path: /updateUserProfile/{companyName}{cognitoUserID}

I have tried this How can i use multiple path parameters from serverless framework but none of it is accepted in my vs code and the AWS documentation does not help either

Is there a way to do this?


Solution

  • I just needed to delete the stack and deploy it from scratch