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

problem using quarkus-resteasy-reactive-kotlin-serialization with AwsProxyRequestContext #23442

Closed
Lukpier opened this issue Feb 4, 2022 · 16 comments · Fixed by #30776
Closed
Assignees
Labels
Milestone

Comments

@Lukpier
Copy link

Lukpier commented Feb 4, 2022

Hi All,

I'm trying to use quarkus-resteasy-reactive-kotlin-serialization on a Kotlin jax-rs reactive endpoint deployed on AWS.
Below the method signature:

  @POST
  @Path("/send")
  fun signUp(request: RegistrationRequest, @Context context: AwsProxyRequestContext): RegistrationResult? =
      service.signUp(request, awsRequestId = request.requestId)

Unfortunately, Quarkus returns Bad request when trying to call this endpoint from APIGateway test page. No error is shown since quarkus itself intercept the request without accessing the method body.

After some trials, I managed to be able to access the context object by using quarkus-resteasy-jackson (so, no kotlin-serialization nor reactive), but this is not what I want to obtain.

Am I missing something?

Thanks for all your work!!

@quarkus-bot
Copy link

quarkus-bot bot commented Feb 4, 2022

@geoand
Copy link
Contributor

geoand commented Feb 4, 2022

Hi,

Kotlin Serialization only works on types that are annotated with @Serializable.

That said, it might be useful to explore how we can support other types as well.

@Lukpier
Copy link
Author

Lukpier commented Feb 4, 2022

Hi geoand,

Thanks for your response. I know that; atm, I'm trying to implement a custom serializer for that object (using KSerializer), since it is the only Aws context object i need to access in my application.

Do you think it could work? I will need to switch to Jackson otherwise.

@geoand
Copy link
Contributor

geoand commented Feb 4, 2022

Do you think it could work?

Can't say since I've never tried something like that. @evanchooly might now more

@geoand geoand added the kind/enhancement New feature or request label Feb 4, 2022
@evanchooly
Copy link
Member

I'd do a bit of experimentation but I think the limitation you're going to run in to is that you need to register and serializers with the SerializersModule used to construct the Json we use. Currently there's no way to configure that as part of quarkus and it seems that's all immutable so it can't be done after the fact.

@Lukpier
Copy link
Author

Lukpier commented Feb 4, 2022

I'd do a bit of experimentation but I think the limitation you're going to run in to is that you need to register and serializers with the SerializersModule used to construct the Json we use. Currently there's no way to configure that as part of quarkus and it seems that's all immutable so it can't be done after the fact.

Understood, so the only solution now is to use jackson (or jsob) for request / context decoding (?)

@geoand
Copy link
Contributor

geoand commented Feb 7, 2022

Yes, Jackson is the only tested way to deserialize input for quarkus-amazon-lambda-rest

@Lukpier
Copy link
Author

Lukpier commented Feb 7, 2022

Yes, Jackson is the only tested way to deserialize input for quarkus-amazon-lambda-rest

Ok, I will use jackson for injecting the entire AwsProxyRequest, then proceeeding as usual with kotlin-serialization.

@Lukpier
Copy link
Author

Lukpier commented Feb 8, 2022

Hi All,

Just encountered a related problem. I'm trying to use quarkus-amazon-lambda-rest together with quarkus-resteasy-reactive-jackson.

Unfortunately, when trying to call the endpoint described in the main issue description, I receive an automatic BAD_REQUEST from quarkus context. Why does it is happening?

Tried also quarkus-resteasy-jackson and everything goes fine, but I was trying to use resteasy reactive in order to make quarkus-rest-client-kotlin-serialization work as a rest-client.

I noticed that in the maven archetype of quarkus-amazon-lambda-rest there is no trace of quarkus-restasy-reactive, but only quarkus-resteasy. So, can I assume that reactive is not supported with quarkus-amazon-lambda-rest ?

Thanks.

@jfalcos
Copy link

jfalcos commented Dec 7, 2022

It looks like this is not a Kotlin specific problem. I tried modifying their rest lambda template to use reactive and got the same error. I think reactive might not be supported at the moment for quarkus-amazon-lambda-rest.

@geoand
Copy link
Contributor

geoand commented Dec 8, 2022

@patriot1burke can you have a look at ^ please?

@jfalcos
Copy link

jfalcos commented Dec 23, 2022

@geoand @patriot1burke hey just wanted to check if there were any updates? thanks!

@geoand
Copy link
Contributor

geoand commented Jan 4, 2023

Can someone attach a sample project where RESTEasy Reactive and Java (not Kotlin) is being used and the project exhibits problematic behavior?

Thanks

@geoand geoand added the triage/needs-reproducer We are waiting for a reproducer. label Jan 27, 2023
@JakubWylezek
Copy link

Hi

I also got this problem in my project.
When I try to call endpoint witch @context param I receive BAD_REQUEST.
Problem occurs only when I using io.quarkus:quarkus-resteasy-reactive.
With io.quarkus:quarkus-resteasy everything works fine
Here some logs:
log

@geoand You can find sample project with issue here https://github.com/JakubWylezek/lambdarestreactive
No param endpoint works fine, second with @context return BAD_REQUEST
With 'io.quarkus:quarkus-resteasy' both works fine

@geoand geoand removed the triage/needs-reproducer We are waiting for a reproducer. label Feb 1, 2023
@geoand
Copy link
Contributor

geoand commented Feb 1, 2023

Thanks, that's most helpful.

I think I know what the problem is.

@geoand
Copy link
Contributor

geoand commented Feb 1, 2023

#30776 fixes the problem

geoand added a commit that referenced this issue Feb 1, 2023
Ensure that AwsProxyRequestContext can be used with @context in RESTEasy Reactive
@quarkus-bot quarkus-bot bot added this to the 2.17 - main milestone Feb 1, 2023
@gsmet gsmet modified the milestones: 3.0 - main, 2.16.2.Final Feb 7, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Feb 7, 2023
benkard added a commit to benkard/mulkcms2 that referenced this issue Apr 2, 2023
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [com.diffplug.spotless:spotless-maven-plugin](https://github.com/diffplug/spotless) | build | minor | `2.32.0` -> `2.33.0` |
| [io.quarkus:quarkus-maven-plugin](https://github.com/quarkusio/quarkus) | build | patch | `2.16.1.Final` -> `2.16.2.Final` |
| [io.quarkus:quarkus-universe-bom](https://github.com/quarkusio/quarkus-platform) | import | patch | `2.16.1.Final` -> `2.16.2.Final` |

---

### Release Notes

<details>
<summary>diffplug/spotless</summary>

### [`v2.33.0`](https://github.com/diffplug/spotless/blob/HEAD/CHANGES.md#&#8203;2330---2023-01-26)

##### Added

-   `ProcessRunner` has added some convenience methods so it can be used for maven testing. ([#&#8203;1496](diffplug/spotless#1496))
-   `ProcessRunner` allows to limit captured output to a certain number of bytes. ([#&#8203;1511](diffplug/spotless#1511))
-   `ProcessRunner` is now capable of handling long-running tasks where waiting for exit is delegated to the caller. ([#&#8203;1511](diffplug/spotless#1511))
-   Allow to specify node executable for node-based formatters using `nodeExecutable` parameter ([#&#8203;1500](diffplug/spotless#1500))

##### Fixed

-   The default list of type annotations used by `formatAnnotations` has had 8 more annotations from the Checker Framework added [#&#8203;1494](diffplug/spotless#1494)

##### Changes

-   **POTENTIALLY BREAKING** Bump minimum JRE from 8 to 11, next release likely to bump bytecode to Java 11 ([#&#8203;1514](diffplug/spotless#1514) part 1 of [#&#8203;1337](diffplug/spotless#1337))
-   Rename `YamlJacksonStep` into `JacksonYamlStep` while normalizing Jackson usage ([#&#8203;1492](diffplug/spotless#1492))
-   Convert `gson` integration to use a compile-only source set ([#&#8203;1510](diffplug/spotless#1510)).
-   \*\* POTENTIALLY BREAKING\*\* Removed support for KtLint 0.3x and 0.45.2 ([#&#8203;1475](diffplug/spotless#1475))
    -   `KtLint` does not maintain a stable API - before this MR, we supported every breaking change in the API since 2019.
    -   From now on, we will support no more than 2 breaking changes at a time.
-   NpmFormatterStepStateBase delays `npm install` call until the formatter is first used. This enables better integration
    with `gradle-node-plugin`. ([#&#8203;1522](diffplug/spotless#1522))
-   Bump default `ktlint` version to latest `0.48.1` -> `0.48.2` ([#&#8203;1529](diffplug/spotless#1529))
-   Bump default `scalafmt` version to latest `3.6.1` -> `3.7.1` ([#&#8203;1529](diffplug/spotless#1529))

</details>

<details>
<summary>quarkusio/quarkus</summary>

### [`v2.16.2.Final`](https://github.com/quarkusio/quarkus/releases/tag/2.16.2.Final)

[Compare Source](quarkusio/quarkus@2.16.1.Final...2.16.2.Final)

##### Complete changelog

-   [#&#8203;30976](quarkusio/quarkus#30976) - Metrics - check if index contains class before attempting to use it
-   [#&#8203;30965](quarkusio/quarkus#30965) - JandexBeanInfoAdapter.getMetricAnnotationsThroughStereotype is not null safe
-   [#&#8203;30959](quarkusio/quarkus#30959) - Return text from /q/metrics when the Accept header contains html
-   [#&#8203;30953](quarkusio/quarkus#30953) - Fix OIDC capability string
-   [#&#8203;30947](quarkusio/quarkus#30947) - Ignore interface/class without default constructs fields in SB config
-   [#&#8203;30940](quarkusio/quarkus#30940) - Use SchemaType.ARRAY instead of "ARRAY" for native support
-   [#&#8203;30919](quarkusio/quarkus#30919) - Compilation to native fails, when quarkus-smallrye-openapi is included
-   [#&#8203;30916](quarkusio/quarkus#30916) - Add AppCDS documentation
-   [#&#8203;30896](quarkusio/quarkus#30896) - Quarkus spring-boot-properties extension unable to handle complex configuration.
-   [#&#8203;30878](quarkusio/quarkus#30878) - Bump postgresql from 42.5.2 to 42.5.3
-   [#&#8203;30866](quarkusio/quarkus#30866) - Only run the quickstart compilation for main
-   [#&#8203;30851](quarkusio/quarkus#30851) - Fixed return type typo in smallrye graphQL guide
-   [#&#8203;30844](quarkusio/quarkus#30844) - Fixed greeting in getting started guide
-   [#&#8203;30839](quarkusio/quarkus#30839) - Fix handling of Accept header in graphQL
-   [#&#8203;30833](quarkusio/quarkus#30833) - Update docs to show BuildProducer use as method parameter instead of field
-   [#&#8203;30828](quarkusio/quarkus#30828) - Make OIDC session cookie same site lax by default
-   [#&#8203;30826](quarkusio/quarkus#30826) - Caffeine - Automatically register metrics cache impls if Micrometer is around
-   [#&#8203;30825](quarkusio/quarkus#30825) - Fix comment about Caffeine optimization
-   [#&#8203;30823](quarkusio/quarkus#30823) - Change accept header to valid plain text in micrometer documentation
-   [#&#8203;30821](quarkusio/quarkus#30821) - Packaging type -Dquarkus.package.create-appcds=true isn't documented
-   [#&#8203;30815](quarkusio/quarkus#30815) - Update SmallRye Config to 2.13.2
-   [#&#8203;30812](quarkusio/quarkus#30812) - Manage the apache-mime4j dependency
-   [#&#8203;30806](quarkusio/quarkus#30806) - */* in Accept header is ignored if not listed as the first item
-   [#&#8203;30805](quarkusio/quarkus#30805) - MailTemplateInstance with attachments
-   [#&#8203;30803](quarkusio/quarkus#30803) - Support file and byte array attachments in `MailTemplateInstance`
-   [#&#8203;30797](quarkusio/quarkus#30797) - OIDC login not work
-   [#&#8203;30783](quarkusio/quarkus#30783) - <artifactId> uses 'quarkus.platform.artifact-id' property
-   [#&#8203;30778](quarkusio/quarkus#30778) - Avoid creating 3 Liquibase MongoDB instances for startup operations
-   [#&#8203;30776](quarkusio/quarkus#30776) - Ensure that AwsProxyRequestContext can be used with [@&#8203;Context](https://github.com/Context) in RESTEasy Reactive
-   [#&#8203;30767](quarkusio/quarkus#30767) - Remove duplicate notification of SseBroadcaster's onErrorListeners
-   [#&#8203;30765](quarkusio/quarkus#30765) - Bump postgresql from 42.5.1 to 42.5.2
-   [#&#8203;30755](quarkusio/quarkus#30755) - Update ForwardedParser to validate the port
-   [#&#8203;30744](quarkusio/quarkus#30744) - \[Quarkus Native] ClassNotFoundException: com.github.benmanes.caffeine.cache.SSSW
-   [#&#8203;30536](quarkusio/quarkus#30536) - munitnyucontextmanager non helpful error reporting
-   [#&#8203;29753](quarkusio/quarkus#29753) - Introduce ConnectionFactoryWrapperBuildItem
-   [#&#8203;29605](quarkusio/quarkus#29605) - Update docs to reflect that injection should not
-   [#&#8203;27774](quarkusio/quarkus#27774) - PLANNER-1709 Avoid deprecated penalize/reward overloads
-   [#&#8203;23442](quarkusio/quarkus#23442) - problem using quarkus-resteasy-reactive-kotlin-serialization with AwsProxyRequestContext

</details>

<details>
<summary>quarkusio/quarkus-platform</summary>

### [`v2.16.2.Final`](quarkusio/quarkus-platform@2.16.1.Final...2.16.2.Final)

[Compare Source](quarkusio/quarkus-platform@2.16.1.Final...2.16.2.Final)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

👻 **Immortal**: This MR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->
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.

6 participants