Skip to content

Commit

Permalink
Fix errors in serverless.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
timbeccue committed Mar 1, 2025
1 parent cb0a741 commit a1c77cf
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ plugins:
- serverless-domain-manager

custom:

# Define the name for the calendar dynamodb table
calendarTableName: calendar-${self:provider.stage}
# Fixed: Define stage first so it can be used in scheduleTrackingTableName
stage: ${opt:stage, "test"}
# Fixed: Use direct reference to stage instead of object lookup
scheduleTrackingTableName: ${self:custom.stage}-schedule-tracking

# Enable point-in-time-recovery for dynamodb
Expand All @@ -26,7 +28,7 @@ custom:

# This is the 'variable' for the customDomain.basePath value, based on the stage.
# Run as `sls deploy --stage <stage_name>`
stage:
stageMap:
prod: calendar
dev: dev
test: test
Expand All @@ -39,11 +41,10 @@ custom:

customDomain:
domainName: 'calendar.photonranch.org'
basePath: ${self:custom.stage.${self:provider.stage}}
basePath: ${self:custom.stageMap.${self:provider.stage}, self:custom.stageMap.test}
stage: ${self:provider.stage}
createRoute53Record: true


provider:
name: aws
stage: ${opt:stage, "test"}
Expand All @@ -70,7 +71,7 @@ provider:
- "dynamodb:BatchWriteItem"
Resource:
- "arn:aws:dynamodb:${self:provider.region}:*:table/${self:custom.calendarTableName}*"
- "arn:aws:dynamodb:${self:provider.region}:*:table/${self:custom.stage}-schedule-tracking"
- "arn:aws:dynamodb:${self:provider.region}:*:table/${self:custom.scheduleTrackingTableName}"

- Effect: Allow
Action:
Expand All @@ -80,7 +81,6 @@ provider:

resources: # CloudFormation template syntax from here on.
Resources:

# Configure API gateway "Gateway Responses" to work with CORS restrictions
GatewayResponseDefault4XX:
Type: 'AWS::ApiGateway::GatewayResponse'
Expand Down Expand Up @@ -170,20 +170,20 @@ resources: # CloudFormation template syntax from here on.
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
scheduleTrackingTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.scheduleTrackingTableName}
AttributeDefinitions:
- AttributeName: ptr_site
AttributeType: S
KeySchema:
- AttributeName: ptr_site
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1

scheduleTrackingTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.scheduleTrackingTableName}
AttributeDefinitions:
- AttributeName: ptr_site
AttributeType: S
KeySchema:
- AttributeName: ptr_site
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1

functions:
authorizerFunc:
Expand Down Expand Up @@ -373,7 +373,6 @@ functions:
- X-Amz-User-Agent
- Access-Control-Allow-Origin
- Access-Control-Allow-Credentials

importSchedulesFromLCO:
handler: import_schedules.import_all_schedules
events:
Expand Down

0 comments on commit a1c77cf

Please sign in to comment.