Repository navigation
Expand file tree
/
Copy pathserverless.yml
More file actions
75 lines (69 loc) · 2.15 KB
/
Copy pathserverless.yml
File metadata and controls
75 lines (69 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
service: aws-custom-authorizer-auth0
frameworkVersion: '4'
package:
patterns:
- '!node_modules/**'
- '!frontend/**'
- '!Makefile'
- '!secrets.example.json'
- '!public_key-example'
custom:
# Built-in python requirements packaging activates on this key.
pythonRequirements:
# Download Linux arm64 wheels for Python 3.15 on any machine, so compiled
# dependencies (such as cryptography) match the Lambda architecture and runtime.
pipCmdExtraArgs:
- '--platform=manylinux2014_aarch64'
- '--platform=manylinux_2_28_aarch64'
- '--python-version=3.15'
- '--only-binary=:all:'
provider:
name: aws
runtime: python3.15
architecture: arm64
region: us-east-1
environment:
AUTH0_CLIENT_ID: ${file(./secrets.json):AUTH0_CLIENT_ID, 'REPLACE-ME'}
AUTH0_CLIENT_PUBLIC_KEY: ${file(./public_key), 'REPLACE-ME'}
functions:
auth:
handler: lambda_handlers.auth
publicEndpoint:
handler: lambda_handlers.public_endpoint
events:
- http:
path: api/public
method: post
cors: true
privateEndpoint:
handler: lambda_handlers.private_endpoint
events:
- http:
path: api/private
method: post
# See custom authorizer docs here: http://bit.ly/2gXw9pO
authorizer: auth
cors: true
resources:
Resources:
# This response is needed for custom authorizer failures cors support ¯\_(ツ)_/¯
GatewayResponse:
Type: 'AWS::ApiGateway::GatewayResponse'
Properties:
ResponseParameters:
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
ResponseType: EXPIRED_TOKEN
RestApiId:
Ref: 'ApiGatewayRestApi'
StatusCode: '401'
AuthFailureGatewayResponse:
Type: 'AWS::ApiGateway::GatewayResponse'
Properties:
ResponseParameters:
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
ResponseType: UNAUTHORIZED
RestApiId:
Ref: 'ApiGatewayRestApi'
StatusCode: '401'