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

GRPC library content type breaks Nexus artifact storage #45685

Open
tmulle opened this issue Jan 17, 2025 · 5 comments
Open

GRPC library content type breaks Nexus artifact storage #45685

tmulle opened this issue Jan 17, 2025 · 5 comments
Assignees
Labels
area/grpc gRPC kind/bug Something isn't working

Comments

@tmulle
Copy link
Contributor

tmulle commented Jan 17, 2025

Describe the bug

This isn't directly a Quarkus bug, but the GRPC library it uses in relation to Nexus/Maven.

We use a corporate Nexus proxy of Maven central as well as our internal libraries.
When trying to build with GRPC libraries in Quarkus I got the following error which ultimately caused Nexus to not store the artifact in the repo.

Turning off strict meta/mime-type validation on the Nexus repo fixes it, but it looks like the mimetype of GRPC is incorrect?

I know most people probably don't use a Nexus Proxy and go straight to Maven Central, I just thought I'd bring it up to help those of us that do and save a day of troublshooting like it took me.

org.sonatype.nexus.repository.view.handlers.ExceptionHandler - Invalid content: GET /io/grpc/protoc-gen-grpc-java/1.65.1/protoc-gen-grpc-java-1.65.1-linux-aarch_64.exe: org.sonatype.nexus.repository.InvalidContentException: Detected content type [application/x-sharedlib], but expected [application/x-executable, application/x-dosexec, application/x-msdownload]: io/grpc/protoc-gen-grpc-java/1.65.1/protoc-gen-grpc-java-1.65.1-linux-aarch_64.exe

Expected behavior

Looks like Nexus thinks the mimetype should be one of: expected [application/x-executable, application/x-dosexec, application/x-msdownload]

Actual behavior

It Detected content type [application/x-sharedlib]

How to Reproduce?

Turn on Validation of mimetype for your repository storage for the Maven Central repo and try to build and you should see an error similiar to:

[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.17.7:generate-code (default) on project code-with-quarkus-temporal: Quarkus code generation phase has failed: Failed to bootstrap application in NORMAL mode: Failed to resolve artifact io.grpc:protoc-gen-grpc-java:exe:linux-aarch_64:1.65.1: The following artifacts could not be resolved: io.grpc:protoc-gen-grpc-java:exe:linux-aarch_64:1.65.1 (absent): Could not find artifact io.grpc:protoc-gen-grpc-java:exe:linux-aarch_64:1.65.1 in nexus-mirror

Output of uname -a or ver

linux and osX

Output of java -version

No response

Quarkus version or git rev

3.17.5

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

maven

Additional information

No response

@tmulle tmulle added the kind/bug Something isn't working label Jan 17, 2025
@quarkus-bot quarkus-bot bot added the area/grpc gRPC label Jan 17, 2025
Copy link

quarkus-bot bot commented Jan 17, 2025

/cc @alesj (grpc), @cescoffier (grpc)

@cescoffier
Copy link
Member

Is it related to gRPC or to the artifact resolver?

@cescoffier
Copy link
Member

From the report, it seems that the resolver is not using the right mime type. But the resolution is delegated to Maven/Gradle. Not sure we can do anything

@tmulle
Copy link
Contributor Author

tmulle commented Jan 19, 2025

I'm not sure, Nexus is downloading the file just fine for Maven but when Nexus runs its validation on the mimetype it fails and doesn't put it into its cache and those artifacts are not available.

Changing Nexus to NOT be strict about the mimetype makes it work which I'm fine with.

I wasn't sure how the mimetype gets set on the artifact themselves which I think is what Nexus is looking at. Something in the metadata?

Anyway, not sure how to fix it I just wanted to bring it up in case other Nexus users hit this.

@aloubyansky
Copy link
Member

@tmulle just for testing purposes, would it work if you added io.grpc:protoc-gen-grpc-java:exe:linux-aarch_64:1.65.1 as a direct dependency of your project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/grpc gRPC kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants