Skip to content

Unable to bind requestParameter to @ModelAttribute form in serverless ~ Spring boot2 #340

@1tkd

Description

@1tkd
  • Framework version: aws-serverless-java-container-springboot2 1.4
  • Implementations: Spring Boot2 (2.1.8)

Scenario

I send a POST request to aws lambda via api gateway.

Expected behavior

In the RequestMapping method,
the request parameter was mapped to form.

Actual behavior

In the RequestMapping method,
i got null from form object.

Steps to reproduce

  1. maven build
    test project

  2. create lambda function
    runtime:java11
    handler:contract.StreamLambdaHandler

  3. create api gateway
    api type:rest
    /{PROXY+}/ANY
    integration type:lambda function

  4. deloy api gateway

  5. access via web browser
    (http://~/(stage)/start)

  6. input some string to v1 input field

  7. press submit

  8. check v2 input filed

Full log output

START RequestId: f5fb028b-4ad5-42d3-b9ef-d6a37e90c0a6 Version: $LATEST
03:37:23.916 [main] INFO com.amazonaws.serverless.proxy.internal.LambdaContainerHandler - Starting Lambda Container Handler
.   ____          _            __ _ _
/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/  ___)| |_)| | | | | || (_| |  ) ) ) )
'  |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::        (v2.1.8.RELEASE)
2020-04-23 03:37:26.084  INFO 8 --- [           main] lambdainternal.AWSLambda                 : Starting AWSLambda on 169.254.142.165 with PID 8 (/var/runtime/lib/aws-lambda-java-runtime-0.2.0.jar started by sbx_user1051 in /var/task)
2020-04-23 03:37:26.085  INFO 8 --- [           main] lambdainternal.AWSLambda                 : No active profile set, falling back to default profiles: default
2020-04-23 03:37:28.354  INFO 8 --- [           main] c.a.s.p.i.servlet.AwsServletContext      : Initializing Spring embedded WebApplicationContext
2020-04-23 03:37:28.354  INFO 8 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2211 ms
2020-04-23 03:37:28.773  WARN 8 --- [           main] org.thymeleaf.templatemode.TemplateMode  : [THYMELEAF][main] Template Mode 'HTML5' is deprecated. Using Template Mode 'HTML' instead.
2020-04-23 03:37:30.275  INFO 8 --- [           main] lambdainternal.AWSLambda                 : Started AWSLambda in 5.583 seconds (JVM running for 7.226)
2020-04-23 03:37:30.358  INFO 8 --- [           main] c.a.s.p.i.servlet.AwsServletContext      : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-04-23 03:37:30.358  INFO 8 --- [           main] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2020-04-23 03:37:30.375  INFO 8 --- [           main] o.s.web.servlet.DispatcherServlet        : Completed initialization in 17 ms
2020-04-23 03:37:31.737  INFO 8 --- [           main] c.a.s.p.internal.LambdaContainerHandler  : 211.9.58.241 - [23/04/2020:03:37:22Z] "POST /write HTTP/1.1" 200 358 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36" combined
END RequestId: f5fb028b-4ad5-42d3-b9ef-d6a37e90c0a6
REPORT RequestId: f5fb028b-4ad5-42d3-b9ef-d6a37e90c0a6	Duration: 1438.57 ms	Billed Duration: 1500 ms	Memory Size: 1536 MB	Max Memory Used: 219 MB	Init Duration: 7281.49 ms	
START RequestId: 950d7ed5-2d17-46be-8069-d0ac0afedfb0 Version: $LATEST
2020-04-23 03:37:41.312  INFO 8 --- [           main] c.a.s.p.internal.LambdaContainerHandler  : 211.9.58.241 - [23/04/2020:03:37:41Z] "POST /write HTTP/1.1" 200 355 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36" combined
END RequestId: 950d7ed5-2d17-46be-8069-d0ac0afedfb0
REPORT RequestId: 950d7ed5-2d17-46be-8069-d0ac0afedfb0	Duration: 8.31 ms	Billed Duration: 100 ms	Memory Size: 1536 MB	Max Memory Used: 219 MB	

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions