Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

sam build fails in Decoupled Microservices Lab Scatter-Gather Lab 3 #307

Open
indranilbanerjee2014 opened this issue Jul 14, 2021 · 0 comments

Comments

@indranilbanerjee2014
Copy link

In the Decoupled Microservices Lab, sam build command fails in the 3rd lab Scatter-Gather - https://async-messaging.workshop.aws/scatter-gather.html

Below is the error I get

indranil:~/environment/wild-rydes-async-messaging/lab-3 $ sam build
Building codeuri: request-for-quotes-service/ runtime: python3.7 metadata: {} functions: ['RequestForQuotesService']
Running PythonPipBuilder:ResolveDependencies

Build Failed
Error: PythonPipBuilder:ResolveDependencies - list index out of range

template.yaml file is pasted below

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
re:invent2019 ARC314-R Lab-3

Sample SAM Template for re:invent2019 ARC314-R Lab-3

More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst

Globals:
Function:
Timeout: 70

Resources:
RequestForQuotesService:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: request-for-quotes-service/
Handler: app.lambda_handler
Runtime: python3.7
Environment:
Variables:
TABLE_NAME: !Ref RidesBookingTable
TOPIC_ARN: !Ref RequestForQuotesTopic
Policies:
- DynamoDBCrudPolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
TableName:
!Ref RidesBookingTable
- SNSPublishMessagePolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
TopicName:
!GetAtt RequestForQuotesTopic.TopicName
Events:
RideBooking:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /submit-instant-ride-rfq
Method: post

QueryForQuotesService:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: query-for-quotes-service/
Handler: app.lambda_handler
Runtime: python3.7
Environment:
Variables:
TABLE_NAME: !Ref RidesBookingTable
TOPIC_ARN: !Ref RequestForQuotesTopic
Policies:
- DynamoDBCrudPolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
TableName:
!Ref RidesBookingTable
- SNSPublishMessagePolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
TopicName:
!GetAtt RequestForQuotesTopic.TopicName
Events:
RideBooking:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /query-instant-ride-rfq/{id}
Method: get

RidesBookingTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: RidesBookingTable
AttributeDefinitions:
- AttributeName: id
AttributeType: S
- AttributeName: responder
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
- AttributeName: responder
KeyType: RANGE
BillingMode: PAY_PER_REQUEST

RequestForQuotesTopic:
Type: AWS::SNS::Topic
Properties:
TopicName: request-for-quotes-topic

RequestForQuotesResponseQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: RequestForQuotesResponseQueue
VisibilityTimeout: 120

UnicornManagementResource1:
Type: AWS::Serverless::Function
Properties:
CodeUri: generic-unicorn-management-service/
Handler: app.lambda_handler
Runtime: python3.7
Environment:
Variables:
SERVICE_NAME: UnicornManagementResource1
QUEUE_URL: !Ref RequestForQuotesResponseQueue
Policies:
- SQSSendMessagePolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
QueueName:
!GetAtt RequestForQuotesResponseQueue.QueueName
Events:
SqsJobQueue:
Type: SNS
Properties:
Topic: !Ref RequestForQuotesTopic

UnicornManagementResource2:
Type: AWS::Serverless::Function
Properties:
CodeUri: generic-unicorn-management-service/
Handler: app.lambda_handler
Runtime: python3.7
Environment:
Variables:
SERVICE_NAME: UnicornManagementResource2
QUEUE_URL: !Ref RequestForQuotesResponseQueue
Policies:
- SQSSendMessagePolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
QueueName:
!GetAtt RequestForQuotesResponseQueue.QueueName
Events:
SqsJobQueue:
Type: SNS
Properties:
Topic: !Ref RequestForQuotesTopic

UnicornManagementResource3:
Type: AWS::Serverless::Function
Properties:
CodeUri: generic-unicorn-management-service/
Handler: app.lambda_handler
Runtime: python3.7
Environment:
Variables:
SERVICE_NAME: UnicornManagementResource3
QUEUE_URL: !Ref RequestForQuotesResponseQueue
Policies:
- SQSSendMessagePolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
QueueName:
!GetAtt RequestForQuotesResponseQueue.QueueName
Events:
SqsJobQueue:
Type: SNS
Properties:
Topic: !Ref RequestForQuotesTopic

UnicornManagementResource4:
Type: AWS::Serverless::Function
Properties:
CodeUri: generic-unicorn-management-service/
Handler: app.lambda_handler
Runtime: python3.7
Environment:
Variables:
SERVICE_NAME: UnicornManagementResource4
QUEUE_URL: !Ref RequestForQuotesResponseQueue
Policies:
- SQSSendMessagePolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
QueueName:
!GetAtt RequestForQuotesResponseQueue.QueueName
Events:
SqsJobQueue:
Type: SNS
Properties:
Topic: !Ref RequestForQuotesTopic

UnicornManagementResource5:
Type: AWS::Serverless::Function
Properties:
CodeUri: generic-unicorn-management-service/
Handler: app.lambda_handler
Runtime: python3.7
Environment:
Variables:
SERVICE_NAME: UnicornManagementResource5
QUEUE_URL: !Ref RequestForQuotesResponseQueue
Policies:
- SQSSendMessagePolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
QueueName:
!GetAtt RequestForQuotesResponseQueue.QueueName
Events:
SqsJobQueue:
Type: SNS
Properties:
Topic: !Ref RequestForQuotesTopic

UnicornManagementResource6:
Type: AWS::Serverless::Function
Properties:
CodeUri: generic-unicorn-management-service/
Handler: app.lambda_handler
Runtime: python3.7
Environment:
Variables:
SERVICE_NAME: UnicornManagementResource6
QUEUE_URL: !Ref RequestForQuotesResponseQueue
Policies:
- SQSSendMessagePolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
QueueName:
!GetAtt RequestForQuotesResponseQueue.QueueName
Events:
SqsJobQueue:
Type: SNS
Properties:
Topic: !Ref RequestForQuotesTopic

UnicornManagementResource7:
Type: AWS::Serverless::Function
Properties:
CodeUri: generic-unicorn-management-service/
Handler: app.lambda_handler
Runtime: python3.7
Environment:
Variables:
SERVICE_NAME: UnicornManagementResource7
QUEUE_URL: !Ref RequestForQuotesResponseQueue
Policies:
- SQSSendMessagePolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
QueueName:
!GetAtt RequestForQuotesResponseQueue.QueueName
Events:
SqsJobQueue:
Type: SNS
Properties:
Topic: !Ref RequestForQuotesTopic

UnicornManagementResource8:
Type: AWS::Serverless::Function
Properties:
CodeUri: generic-unicorn-management-service/
Handler: app.lambda_handler
Runtime: python3.7
Environment:
Variables:
SERVICE_NAME: UnicornManagementResource8
QUEUE_URL: !Ref RequestForQuotesResponseQueue
Policies:
- SQSSendMessagePolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
QueueName:
!GetAtt RequestForQuotesResponseQueue.QueueName
Events:
SqsJobQueue:
Type: SNS
Properties:
Topic: !Ref RequestForQuotesTopic

UnicornManagementResource9:
Type: AWS::Serverless::Function
Properties:
CodeUri: generic-unicorn-management-service/
Handler: app.lambda_handler
Runtime: python3.7
Environment:
Variables:
SERVICE_NAME: UnicornManagementResource9
QUEUE_URL: !Ref RequestForQuotesResponseQueue
Policies:
- SQSSendMessagePolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
QueueName:
!GetAtt RequestForQuotesResponseQueue.QueueName
Events:
SqsJobQueue:
Type: SNS
Properties:
Topic: !Ref RequestForQuotesTopic

UnicornManagementResource10:
Type: AWS::Serverless::Function
Properties:
CodeUri: generic-unicorn-management-service/
Handler: app.lambda_handler
Runtime: python3.7
Environment:
Variables:
SERVICE_NAME: UnicornManagementResource10
QUEUE_URL: !Ref RequestForQuotesResponseQueue
Policies:
- SQSSendMessagePolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
QueueName:
!GetAtt RequestForQuotesResponseQueue.QueueName
Events:
SqsJobQueue:
Type: SNS
Properties:
Topic: !Ref RequestForQuotesTopic

QuotesResponseService:
Type: AWS::Serverless::Function
Properties:
CodeUri: quotes-response-service/
Handler: app.lambda_handler
Runtime: python3.7
Environment:
Variables:
TABLE_NAME: !Ref RidesBookingTable
Policies:
- DynamoDBCrudPolicy: # https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/policy_templates_data/policy_templates.json
TableName:
!Ref RidesBookingTable
Events:
SQSQueue:
Type: SQS
Properties:
Queue: !GetAtt RequestForQuotesResponseQueue.Arn
BatchSize: 1

Outputs:
RideBookingApiSubmitInstantRideRfqEndpoint:
Description: "API Gateway endpoint URL for Prod stage for RideBookingService submit-instant-ride-rfq resource"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/submit-instant-ride-rfq/"
RideBookingApiQueryInstantRideRfqEndpoint:
Description: "API Gateway endpoint URL for Prod stage for RideBookingService query-instant-ride-rfq resource"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/query-instant-ride-rfq/{id}"

RideBookingService:

Description: "RideBookingService Lambda Function ARN"

Value: !GetAtt RideBookingService.Arn

RequestForQuotesTopic:
Description: "Amazon SNS topic ARN for RequestForQuotes topic"
Value: !Ref RequestForQuotesTopic

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant