GoogleCloudPlatform / GoogleCloudPlatform/spring-cloud-gcp

secretmanager config import cause native image docker silently crash

Open
#2,782 2 comments 0 reactions 0 assignees View on GitHub
priority: p3 type: bug
Dominant language
Java
Stars
551
Forks
349
Avg merge
1d 13h
Merged PRs (30d)
14

Description

**Describe the bug**

Library used:

'org.springframework.boot' version '3.2.4'

'spring-cloud-gcp-starter-secretmanager', version: '5.1.2'

'org.graalvm.buildtools.native' version '0.10.1'

Get a `application.yaml` like this:
```yaml
spring:
config:
import: sm://
```

With a minimal application entrypoint:
```kotlin
@SpringBootApplication
open class Application

fun main() {
runApplication()
}
```

Then compile it to Graalvm native image docker and run

```
./gradlew bootBuildImage

docker run docker.io/library/spring-boot-gcp-secretmanager-native-image-crash:1.0-SNAPSHOT
```

The docker crashes as soon as it is executed, **without any output**

Extra attempts:
1. If i remove `spring.config.import` in application.yaml, all things works well. So this problem only occurs when `sm://` is used

2. If i don't package the native image as docker, **it works fine**:
```bash
./gradlew nativeRun
```
OR:
```bash
./gradlew nativeCompile
./build/native/nativeCompile/spring-boot-gcp-secretmanager-native-image-crash
```
Maybe secretmanager is conflicting with something in spring boot docker?

3. Whether or not i use `sm://xxx` on other properties to get the variable, it will crash as soon as i have `spring.config.import`. So i just provided a minimized example

**Sample**
See my repository: https://github.com/czp3009/spring-boot-gcp-secretmanager-native-image-crash

Please follow the README to build and run the docker to see what happen

Contributor guide

Open the contributing guide

Research direction

Follow the linked reproduction repository's README and begin with application.yaml, the minimal Kotlin entrypoint, and the bootBuildImage/native image commands. Compare the Docker run behavior with nativeRun and nativeCompile; done means the Docker image starts and runs successfully when spring.config.import uses sm://.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, google-cloud, kotlin, spring-boot
Domain
backend, build-system, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.