To use the Node.js SDK, you must supply service account credentials via an environment variable or constructor. If you want Do the following to use an environment variable for the service account JSON file, you’ll need to do the following:
Save your credentials JSON file in your function’s directory (i.e., in the same folder with the entry point index.js file). In this example, it will be saved in a file named
dev-credentials.json
in alib
folder.When deploying your function with the
gcloud functions deploy
command, use the--set-env-vars
flag to set the path. It must be prefixed with/workspace
to work correctly. Example:--set-env-vars CLEARBLADE_CONFIGURATION=/workspace/lib/dev-credentials.json
.