-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spring Cloud function - MultiValueMap Request - Jetty [mvn function:run] fails - Tomcat [mvn test] OK #1125
Comments
1 - If running through Eclipse, it works as expected: 2 - I had to downgrade to spring-boot 3.1.6 due to this issue: After 1) and 2), i still get the same error when the Cloud Function is deployed in GCP: |
I was able to sort this out, with the help of a friend. Basically, i would have to change the signature to receive an Object, and then cast to a BufferedReader. I tested this and it worked.
In the end, i opted to use Quarkus. |
I have a simple Spring cloud function, which was developed according to the guidelines provided by Spring Cloud documentation.
Step 1: Add the spring-cloud-function-adapter-gcp dependency:
Step 2: Add the spring-boot-maven-plugin which will build the JAR of the function to deploy
Step 3: Add the Maven plugin provided as part of the Google Functions Framework for Java. This allows to test locally via mvn function:run.
Step 4: The Spring Cloud Function Code
Step 5: Create Unit test for startup
Step 6: Execute unit test:
Step 7: Run the function locally
Step 8: Use CURL to send a x-www-form-urlencoded Request:
curl -i -X POST http://localhost:8080/ -H "Content-Type: application/x-www-form-urlencoded" -d "param1=value1¶m2=value2"
Which generates the following error:
Question: It seems that the error is due to the Tests using Tomcat, and when the function runs, it uses Jetty via spring-cloud-function-adapter-gcp.
Why does this happen, and what can i do to overcome this error?
The project can be downloaded here:
cloud-function.zip
The text was updated successfully, but these errors were encountered: