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

Issue with multiform data rest client on Quarkus 3.14 #43364

Closed
djphatmix opened this issue Sep 18, 2024 · 16 comments · Fixed by #43437
Closed

Issue with multiform data rest client on Quarkus 3.14 #43364

djphatmix opened this issue Sep 18, 2024 · 16 comments · Fixed by #43437
Labels
area/rest-client kind/bug Something isn't working
Milestone

Comments

@djphatmix
Copy link

djphatmix commented Sep 18, 2024

Describe the bug

I have the below rest endpoint. Whenever I start Quarkus, I get an error saying that my rest client has not been indexed at build time. I am using Quarkus 3.14.1

public class Request {
    
    @RestForm("file")
    @PartType(MediaType.APPLICATION_OCTET_STREAM)
    private InputStream file;

    @RestForm("filename")
    @PartType(MediaType.TEXT_PLAIN)
    private String filename;
}

Endpoint definition:

    @POST
    @Path("/upload")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    @Produces(MediaType.APPLICATION_JSON)
    public String upload(Request request) {
      // business logic.
        return "done";
    }

Error:
Caused by: java.lang.IllegalStateException: REST client interface: interface com.test.api.restclient.TestRestApi was not indexed at build time.

Expected behavior

The expectation is that the app should start up without any issues.

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@djphatmix djphatmix added the kind/bug Something isn't working label Sep 18, 2024
Copy link

quarkus-bot bot commented Sep 18, 2024

/cc @cescoffier (rest-client), @geoand (rest-client)

@djphatmix djphatmix changed the title Issue with mutli form data rest client Issue with multiform data rest client on Quarkus 3.14 Sep 18, 2024
@geoand geoand added kind/question Further information is requested and removed kind/bug Something isn't working labels Sep 18, 2024
@geoand
Copy link
Contributor

geoand commented Sep 18, 2024

Is TestRestApi in another module?

@djphatmix
Copy link
Author

djphatmix commented Sep 18, 2024

Yes, TestRestAPI is in a different module. I did add the jandex plugin in my POM but it does not seem to make a difference.

<build>
     <plugins>
       <plugin>
         <groupId>io.smallrye</groupId>
         <artifactId>jandex-maven-plugin</artifactId>
         <version>3.1.2</version>
         <executions>
           <execution>
             <id>make-index</id>
             <goals>
               <goal>jandex</goal>
             </goals>
           </execution>
         </executions>
       </plugin>
     </plugins>
   </build>

@geoand
Copy link
Contributor

geoand commented Sep 18, 2024

Have you tried the META-INF/beans.xml method described here?

@djphatmix
Copy link
Author

djphatmix commented Sep 18, 2024

I did try it. So basically what we have observed is that once we remove the inputStream parameter on the Request then everything works as expected.

My issue is very similar to this one #42077.

@geoand
Copy link
Contributor

geoand commented Sep 18, 2024

Very interesting.

If you attach a sample application that exhibits the problem in action, I can do a deep dive and see what can be done.

@geoand geoand added the triage/needs-reproducer We are waiting for a reproducer. label Sep 18, 2024
@cescoffier cescoffier added kind/bug Something isn't working and removed kind/question Further information is requested labels Sep 19, 2024
@djphatmix
Copy link
Author

djphatmix commented Sep 22, 2024

I have created 2 projects(producer and consumer). In my consumer project, ExampleResourceTest.java fails with the below error message.

Error:
Caused by: java.lang.IllegalStateException: REST client interface: interface za.co.tutorial.StickerDefinitionRestApi was not indexed at build time. See https://quarkus.io/guides/cdi-reference#bean_discovery for information on how to index the module that contains it.
at org.jboss.resteasy.reactive.client.impl.ClientProxies.get(ClientProxies.java:35)
at org.jboss.resteasy.reactive.client.impl.WebTargetImpl.proxy(WebTargetImpl.java:449)
at io.quarkus.rest.client.reactive.runtime.RestClientBuilderImpl.build(RestClientBuilderImpl.java:528)

I have also attached the sample projects.
consumer.zip
producer.zip

@djphatmix
Copy link
Author

Very interesting.

If you attach a sample application that exhibits the problem in action, I can do a deep dive and see what can be done.

I have uploaded the two projects. The rest API is defined inside a project called sample and the failing test is defined inside the consumer project.

@geoand
Copy link
Contributor

geoand commented Sep 23, 2024

Thanks, I'll check soon

@geoand
Copy link
Contributor

geoand commented Sep 23, 2024

Your reproducer was super helpful, thanks!

#43437 fixes the issue

@djphatmix
Copy link
Author

Your reproducer was super helpful, thanks!

#43437 fixes the issue

So will the fix go into 3.14.4 or will it be part of a new patch release?

@geoand
Copy link
Contributor

geoand commented Sep 23, 2024

I will hopefully be part of 3.15.1

@djphatmix
Copy link
Author

djphatmix commented Sep 23, 2024

I will hopefully be part of 3.15.1

So what is the tentative release date for 3.15.1?

@geoand
Copy link
Contributor

geoand commented Sep 23, 2024

Towards the end of the month or beginning of October unless something unforeable happens

@djphatmix
Copy link
Author

Towards the end of the month or beginning of October unless something unforeable happens

Thanks for the quick response.

@geoand
Copy link
Contributor

geoand commented Sep 23, 2024

🙏🏽

geoand added a commit that referenced this issue Sep 23, 2024
Make media type optional for InputStream when using multipart in REST Client
@quarkus-bot quarkus-bot bot added this to the 3.16 - main milestone Sep 23, 2024
mskacelik pushed a commit to mskacelik/quarkus that referenced this issue Sep 27, 2024
@gsmet gsmet modified the milestones: 3.16.0.CR1, 3.15.2 Oct 18, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 21, 2024
bschuhmann pushed a commit to bschuhmann/quarkus that referenced this issue Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest-client kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants