Skip to content
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

Quarkus + Resteasy + Google Cloud Functions: status code alway 200 no matter what #15510

Closed
HardNorth opened this issue Mar 5, 2021 · 1 comment · Fixed by #15620
Closed
Labels
Milestone

Comments

@HardNorth
Copy link
Contributor

HardNorth commented Mar 5, 2021

Describe the bug
I'm trying to implement a simple service using Google Cloud Functions and Quarkus. But if I'm trying to return any status except 200, I will always get 200. E.G.:

	@GET
	@Path("error")
	@Produces(MediaType.TEXT_PLAIN)
	public Response error(@Context UriInfo uriInfo) {
		String uriStr = uriInfo.getBaseUri().toString() + uriInfo.getPath(true) + uriInfo.getQueryParameters();
		return Response.status(Response.Status.BAD_REQUEST)
				.encoding("UTF-8")
				.entity(uriStr + "\nmy error").build();
	}

Expected behavior
Status code 400

Actual behavior
Status code 200

To Reproduce
I've implemented a very small test service to reproduce the issue:
https://github.com/HardNorth/quarkus-google-functions-test/blob/main/src/main/java/net/hardnorth/test/quarkus/QuarkusTestService.java

You need to deploy it into Google Cloud. Because it works locally.

Configuration
Doesn't matter at all

Additional context
Based on what I see from code there is a missing part in QuarkusHttpFunction.java. E.G. for Amazon lambdas you bypass status and reason phrase explicitly:
https://github.com/quarkusio/quarkus/blob/master/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java#L91

But there is no such logic for Google Functions (you convert only headers):
https://github.com/quarkusio/quarkus/blob/master/extensions/google-cloud-functions-http/runtime/src/main/java/io/quarkus/gcp/functions/http/QuarkusHttpFunction.java#L145

@HardNorth HardNorth added the kind/bug Something isn't working label Mar 5, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Mar 5, 2021

/cc @loicmathieu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant