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: no query parameters bypass #15501

Closed
HardNorth opened this issue Mar 5, 2021 · 11 comments · Fixed by #15620
Closed

Quarkus + Resteasy + Google Cloud Functions: no query parameters bypass #15501

HardNorth opened this issue Mar 5, 2021 · 11 comments · Fixed by #15620
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 use @QueryParam annotation I'm getting nulls in any param. E.G.:

	@GET
	@Path("echo1")
	@Produces(MediaType.TEXT_PLAIN)
	public Response echo1(@QueryParam("test") String test) {
		return Response.status(Response.Status.OK)
				.encoding("UTF-8")
				.entity("test: " + test).build();
	}

Expected behavior

test: test string

Actual behavior

test: null

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 have a whole loop which appends query parameters to path variable:
https://github.com/quarkusio/quarkus/blob/master/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java#L154

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

@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

@loicmathieu
Copy link
Contributor

@HardNorth I confirm query params didn't works.

Thanks for pointing me to the missing piece of code ;) I'll try to provide a fix soon.

@loicmathieu
Copy link
Contributor

@HardNorth in fact, the piece of code you pointed to is not for amazon-lambda-http so not related to query string support on with resteasy. Anyway I'll have a look.

@HardNorth
Copy link
Contributor Author

@loicmathieu Thanks for watching into this! Please excuse me but let me hightlight it again: the bug within Goggle Cloud Functions handling code, Amazon code I pointed serves for example and does very similar thing, of course it's not one-to-one. And I actually made a workaround in my project which fixes the issue:
https://github.com/HardNorth/service-merge-validate/blob/develop/src/main/java/net/hardnorth/quarkus/gcp/functions/http/QuarkusHttpFunction.java#L89

The class is actually copy-paste from your code with two differences: fixes for this and issue #15510

Sorry if I wasn't clear first.

@loicmathieu
Copy link
Contributor

Yes, maybe the issue also exist for amazon-lanbda-http ...

If you already have a fix for it, you can open a pull request if you want to contribute it.
Or I can do it, just tell me ;)

@HardNorth
Copy link
Contributor Author

@loicmathieu Sure I will open the request.

@HardNorth
Copy link
Contributor Author

ETA: tomorrow, since I want to cover it with tests and it's late evening in my timezone.

@HardNorth
Copy link
Contributor Author

HardNorth commented Mar 9, 2021

Had hard time building quarkus project :-/ Need additional day or two.

If you guys have a guide how partially build the project I would appreciate it.

@gsmet
Copy link
Member

gsmet commented Mar 9, 2021

@HardNorth have you seen https://github.com/quarkusio/quarkus/blob/master/CONTRIBUTING.md#build ? That might help.

@loicmathieu
Copy link
Contributor

@HardNorth no worry, take your time, if you need help you can also reach to me on Zulip, you can ask question about how to build Quarkus on the dev channel: https://quarkusio.zulipchat.com/#reload:859994484326
Or send me a PM if you have a specific question.

@HardNorth
Copy link
Contributor Author

@loicmathieu @gsmet Posted a pull-request: #15620

@quarkus-bot quarkus-bot bot added this to the 1.14 - main milestone Mar 24, 2021
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.

3 participants