0

Assume we're deploying GCP Cloud Functions from a GitHub repo (mirrored via GCP Source Repositories). Is it possible to set up shared code that can be accessed by both functions below? (e.g. via helpers.py).

helpers.py
function_one/
├── main.py
function_two/
├── main.py
CHRD
  • 1,917
  • 1
  • 15
  • 38
  • If you are using Linux, create a file link so that a link to helpers.py is in both directories (function_one and function_two). – John Hanley Jan 20 '21 at 16:43

2 Answers2

-1

Not exactly, since each function is a separate entity. But you could move your helpers.py to its own repository, then import the repository within each individual function.

niyi
  • 319
  • 2
  • 3
-1

Normally you make a library out of your helpers (like any other libs in your requirements), then you import it as a dependency of function1 or function2.

Cloud Functions will get all your functions dependencies before running the function1.

Fabio B.
  • 970
  • 2
  • 14
  • 29