firebase / firebase/firebase-admin-java

Running a native image on GCP (Cloud Run) throws error 400

Open
#860 2 comments 0 reactions 0 assignees View on GitHub
api: core api: messaging
Dominant language
Java
Stars
620
Forks
305
Avg merge
3h 23m
Merged PRs (30d)
1

Description

Hi,

Compiling to native this dependency:
```java

com.google.firebase
firebase-admin
9.2.0

```

makes the build fail because grpc-netty-shaded, however with this alternative we can compile:
```java


com.google.firebase
firebase-admin
9.2.0


io.grpc
grpc-netty-shaded




io.grpc
grpc-okhttp
1.51.1

```

The problem is that FCM client always responds with error 400:
```javascript
Exception in thread "main" com.google.firebase.messaging.FirebaseMessagingException: Unexpected HTTP response with status: 400
{
"error": {
"code": 400,
"message": "Recipient of the message is not set.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "message",
"description": "Recipient of the message is not set."
}
]
},
{
"@type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "INVALID_ARGUMENT"
}
]
}
}
```

Running on JVM works fine.
There is a issue with same problem: https://github.com/GoogleCloudPlatform/native-image-support-java/issues/116 for the old google native support libraries. Their workarounds didn't work for me.

Are there any know solutions?
Thanks

Contributor guide

Open the contributing guide

Research direction

Start with the Firebase Admin dependency declarations and the Firebase Cloud Messaging client running as a native image on Cloud Run, comparing the reported JVM and native-image behavior. Reproduce the 400 response with the grpc-netty-shaded exclusion and grpc-okhttp substitution, then determine whether the issue is in request construction or the native-image configuration. Done means documenting a supported configuration or a minimal reproducible diagnosis.

Written by the indexing model from the issue text.

Assessment

Tech stack
firebase, gcp, grpc, java
Domain
backend-api-design, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.