googleapis / googleapis/google-cloud-java

[java-bigquery] BigQuery request missing projectId in URL when running in Native Image

Offen
#12,150 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
api: bigquery priority: p3
Vorherrschende Sprache
Java
Sterne
2.1k
Forks
1.2k
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
154

Beschreibung

Hello,

I'm experiencing an issue where the projectId is missing from the BigQuery request URL when running my Spring Boot application compiled as a GraalVM Native Image.

Expected Behavior:

The request should include the projectId in the URL, like this:

```bash
POST https://www.googleapis.com/bigquery/v2/projects/{my-project-id}/queries
```

Actual Behavior:

However, when running as a Native Image, the request URL is missing the projectId:

```bash
POST https://www.googleapis.com/bigquery/v2/projects//queries
```

This results in a 404 Not Found error from the BigQuery API.

## Steps to Reproduce:

Use the Google Cloud BigQuery Client in a Spring Boot application.

1. Set the projectId explicitly in BigQueryOptions:

```java
BigQuery bigQuery = BigQueryOptions.newBuilder()
.setProjectId("my-project-id")
.setCredentials(GoogleCredentials.getApplicationDefault())
.build()
.getService();
```

2. Compile the application using GraalVM Native Image.
3. Run the application and observe the logs.
4. The request URL to BigQuery does not include the projectId, causing a 404 Not Found error.

## Additional Information:

- When running in JVM mode (mvn spring-boot:run), the request works correctly, and the projectId is included in the URL.
- Only the Native Image build has this issue.
- I have verified that projectId is correctly set in the application properties and logs before making the request.

## Environment Details:
- Google Cloud BigQuery Client Version: 1.2.8.RELEASE
- Spring Boot Version: 3.2.5
- Operating System: macOS 14.1.1 (23B81)
- JDK:
```bash
openjdk version "21.0.6" 2025-01-21 LTS
OpenJDK Runtime Environment Liberica-NIK-23.1.6-1 (build 21.0.6+10-LTS)
OpenJDK 64-Bit Server VM Liberica-NIK-23.1.6-1 (build 21.0.6+10-LTS, mixed mode, sharing)
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.