-
Notifications
You must be signed in to change notification settings - Fork 5
AWS Lambda Support
Make custom extensions work with AWS API Gateway + Lambda.
Refer to Quick start Spring Boot · awslabs/aws-serverless-java-container Wiki and edit custom extensions.
This repository also contains a sample that you can refer to.
This is the setting required to run the test with API Gateway and Lambda Function.
cek.verifier.signature.enabled: falseSet true when testing from a Clova device or the Clova Developer Center.
Create API Gateway resource as a proxy resource.
Create a Lambda Function.
Upload echo-lambda as a function package.
$ ./mvnw clean package -Plambda -f samples/echo-lambda/pom.xml Upload the newly created samples/echo-lambda/target/echo-lambda-1.0.0.jar and set com.linecorp.clova.extension.sample.echo_lambda.StreamLambdaHandler::handleRequest as Handler.
Set API Gateway as the trigger and specify the api you created.
Create a test event.
Edit the JSON of API Gateway AWS Proxy template.
| path | value |
|---|---|
.body |
CEK Request |
.headers.Content-Type |
application/json;charset=utf-8 |
.httpMethod |
POST |
.path |
/ (=${cek.api-path}) |
The JSON of CEK Request is obtained as follows.
- In the Clova Developer Center, access
対話モデル(Dialogue model) ->テスト(Test) - Run test
- Copy
JSONのサービスリクエスト(JSON of a service request) - Format it by
jqcommand. Here is an example of Mac OS command.
$ pbpaste | jq -c ". | @json" | pbcopyRun the test event. It will succeed if .statusCode is 200.
If you get an error, try the following.
- Remove
spring-boot-starter-actuatorfrom the dependencies. - Fix if there is a warning when generating the jar file
- Make the scope of
lombokprovided.
- Make the scope of
- Try to change the value of
cek.api-path.
In the Clova Developer Center, access 基本情報(Basic Information) -> サーバー設定(Server Settings) and set the URL of the resource registered in API Gateway as ExtensionサーバーのURL(Extension server URL).