To use the Node.js SDK, you must supply service account credentials via an environment variable or constructor. Do the following to use an environment variable for the service account JSON file:
-
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.jsonin alibfolder. -
When deploying your function with the
gcloud functions deploycommand, use the--set-env-varsflag to set the path. It must be prefixed with/workspaceto work correctly. Example:--set-env-vars CLEARBLADE_CONFIGURATION=/workspace/lib/dev-credentials.json.