checkmarble / marble

Marble - the real time decision engine for fraud and AML
https://www.checkmarble.com
Other
155 stars 14 forks source link

Marble API : Error while Initializing Firebase #32

Closed nickykln closed 1 month ago

nickykln commented 1 month ago

While removing the lines for Firebase Simulator FIREBASE_AUTH_EMULATOR_HOST_CLIENT=localhost:9099 FIREBASE_AUTH_EMULATOR_HOST_SERVER=localhost:9099

I have the following error :

marble-api | panic: error getting Auth client: google: could not find default credentials. See https://cloud.google.com/docs/authentication/external/set-up-adc for more information

marble-api | goroutine 1 [running]: marble-api | github.com/checkmarble/marble-backend/infra.InitializeFirebase({0x1bec0f8, 0xc00040aed0}) marble-api | /go/src/app/infra/firebase_client.go:19 +0x73 marble-api | github.com/checkmarble/marble-backend/cmd.RunServer() marble-api | /go/src/app/cmd/server.go:96 +0xb1d marble-api | main.main() marble-api | /go/src/app/main.go:35 +0x4eb

nickykln commented 1 month ago

I found a workaround by modifying the file docker-compose.yaml

For the marble-api container,

1) I have added a volume - ./share:/share (mapping a local folder, in the container) 2) Add an env variable : GOOGLE_APPLICATION_CREDENTIALS: ${GOOGLE_APPLICATION_CREDENTIALS:-} 3) Get my credential file from firebase and copy in the local share folder 4) Reference the path to this file in the variable GOOGLE_APPLICATION_CREDENTIALS

Let me know if there is a better solution or if we could integrate the firebase auth for marble-api in future release.

Thanks a lot

Pascal-Delange commented 1 month ago

Hi @nickykln , Thanks for pointing this out. Can you please confirm that you have this issue when running the application in a non-GCP environment ? (I expect service account discovery to happen automatically in a GCP VM). In any case, your workaround is the correct solution to this issue. I make a note to document this in the github repo in the next release. You will also need to set proper values for all the FIREBASE_ environment variables by the front-end container.

Pascal-Delange commented 1 month ago

Hi, I added some help related to this in the latest release https://github.com/checkmarble/marble/pull/33 Thanks again for pointing out the issue