google-cloud-dotnet: Missing GOOGLE_APPLICATION_CREDENTIALS env variable in flex for .NET core?
I’m trying to use datastore from a F# .NET Core 2.0 application. The code works fine locally and I expected it to do so on AppEngine as well.
Info about the app:
- Docker base image:
gcr.io/google-appengine/aspnetcore:2.0
- Version of datastore package:
2.1.0-alpha00
- Code to create datastoredb:
DatastoreDb.Create("MY GOOGLE PROJECT")
- App yaml
env: flex
runtime: custom
service: service-name
manual_scaling:
instances: 1
Result:
Unhandled Exception: System.TypeInitializationException: The type initializer for ‘<StartupCode$FatSlack>.$Program’ threw an exception. —> System.InvalidOperationException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information. at Google.Api.Gax.TaskExtensions.WaitWithUnwrappedExceptions(Task task) at Google.Api.Gax.Grpc.ChannelPool.GetChannel(ServiceEndpoint endpoint) at Datastore.getToken(String kind, String name) in /Users/tomasjansson/git/unacast/CoreService/src/FatSlack/Datastore.fs:line 7
Expected result:
An instance of the DataStoreDb
is created.
I thought that those where somehow automatically mounted when a custom flex application was started. I realize that this might not be an issue with the framework, but rather how custom flex appications are started on app engine.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 83 (1 by maintainers)
Not at my computer right now, but will check when I’m back.
@Jonathan34: I’m using that one because it’s the one @mastoj is using. I’m trying to be as similar as I can, without venturing into F# 😉