question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[GCP] Error while deploying Cloud Function

See original GitHub issue

Once I have everything set up following the instructions (lithops version 2.7.0 and python 3.9.13).

I run a lithops test and I get an error saying “Error while deploying Cloud Function”.

Click to see error trace
    2022-11-03 13:03:33,899 [INFO] config.py:131 -- Lithops v2.7.0
    2022-11-03 13:03:34,195 [INFO] gcp_storage.py:45 -- Google Cloud Storage client created
    2022-11-03 13:03:34,276 [INFO] gcp_functions.py:56 -- Google Cloud Functions client created - Region: us-east1 - Project: gfinol-lithops-debug
    2022-11-03 13:03:34,276 [INFO] invokers.py:108 -- ExecutorID 562265-0 | JobID A000 - Selected Runtime: lithops-default-runtime-v39 - 256MB
    2022-11-03 13:03:34,810 [INFO] invokers.py:116 -- Runtime lithops-default-runtime-v39 with 256MB is not yet deployed
    2022-11-03 13:03:34,810 [INFO] gcp_functions.py:273 -- Deploying runtime: lithops-default-runtime-v39 - Memory: 256 Timeout: 300
    2022-11-03 13:03:34,811 [INFO] gcp_functions.py:241 -- Building runtime lithops-default-runtime-v39 from /tmp/gcf_default_requirements.txt
    2022-11-03 13:04:37,617 [INFO] gcp_functions.py:225 -- Waiting for the function to be deployed
    Traceback (most recent call last):
    File "/home/gerard/.anaconda3/envs/py39/bin/lithops", line 8, in <module>
        sys.exit(lithops_cli())
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
        return self.main(*args, **kwargs)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 1055, in main
        rv = self.invoke(ctx)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
        return ctx.invoke(self.callback, **ctx.params)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 760, in invoke
        return __callback(*args, **kwargs)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/lithops/scripts/cli.py", line 173, in test_function
        fexec.call_async(hello, username)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/lithops/executors.py", line 209, in call_async
        runtime_meta = self.invoker.select_runtime(job_id, runtime_memory)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/lithops/invokers.py", line 117, in select_runtime
        runtime_meta = self.compute_handler.deploy_runtime(self.runtime_name, runtime_memory, runtime_timeout)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/lithops/serverless/serverless.py", line 73, in deploy_runtime
        return self.backend.deploy_runtime(runtime_name, memory, timeout=timeout)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/lithops/serverless/backends/gcp_functions/gcp_functions.py", line 278, in deploy_runtime
        self._create_function(runtime_name, memory, timeout)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/lithops/serverless/backends/gcp_functions/gcp_functions.py", line 234, in _create_function
        raise Exception('Error while deploying Cloud Function')
    Exception: Error while deploying Cloud Function

This is a screenshot of the error in the Google cloud console:

image

I also tried to create a custom runtime using lithops runtime build -f requirements.txt -b gcp_functions my_Image_runtime -s gcp_storage

But I get a AttributeError: 'NoneType' object has no attribute 'put_data'.

Click to see error trace
    2022-11-03 13:08:02,137 [INFO] config.py:131 -- Lithops v2.7.0
    2022-11-03 13:08:02,138 [DEBUG] config.py:90 -- Loading configuration from /home/gerard/.lithops/config
    2022-11-03 13:08:02,155 [DEBUG] config.py:183 -- Loading Serverless backend module: gcp_functions
    2022-11-03 13:08:02,379 [DEBUG] gcp_functions.py:79 -- Getting GCP credentials from /home/gerard/.lithops/gfinol-lithops-debug-7dea7b8f11a1.json
    2022-11-03 13:08:02,464 [INFO] gcp_functions.py:56 -- Google Cloud Functions client created - Region: us-east1 - Project: gfinol-lithops-debug
    2022-11-03 13:08:02,464 [INFO] gcp_functions.py:241 -- Building runtime my_Image_runtime from requirements.txt
    2022-11-03 13:08:02,464 [DEBUG] utils.py:228 -- Creating function handler zip in /tmp/lithops_gcp_functions.zip
    Traceback (most recent call last):
    File "/home/gerard/.anaconda3/envs/py39/bin/lithops", line 8, in <module>
        sys.exit(lithops_cli())
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
        return self.main(*args, **kwargs)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 1055, in main
        rv = self.invoke(ctx)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
        return ctx.invoke(self.callback, **ctx.params)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/click/core.py", line 760, in invoke
        return __callback(*args, **kwargs)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
        return f(get_current_context(), *args, **kwargs)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/lithops/scripts/cli.py", line 451, in build
        compute_handler.build_runtime(runtime_name, file, ctx.args)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/lithops/serverless/serverless.py", line 66, in build_runtime
        self.backend.build_runtime(runtime_name, file, extra_args)
    File "/home/gerard/.anaconda3/envs/py39/lib/python3.9/site-packages/lithops/serverless/backends/gcp_functions/gcp_functions.py", line 254, in build_runtime
        self.internal_storage.put_data(bin_location, action_bin)
    AttributeError: 'NoneType' object has no attribute 'put_data'

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
gfinolcommented, Nov 7, 2022

Yes, it worked after installing from master branch. 🎉

0reactions
JosepSampecommented, Nov 7, 2022

@gfinol I added a fix. Can you try with master branch?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Cloud Functions - Google Cloud
Function deployment fails while executing function's global scope. This error indicates that there was a problem with your code. The deployment pipeline ...
Read more >
Firebase cloud function deploy error - Stack Overflow
Go to Google cloud functions console and see if there is red exclamation mark against your function. Then select that particular function ...
Read more >
How to debug a Cloud Function deployment error
TL;DR: Just go to the Google Cloud Console; select your project; choose a function you'd like to debug; and click on "view logs"....
Read more >
Cloud Function deployment using gcloud failing for updated ...
It failed with error 'ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Function failed on loading user code. This is likely due to a bug in the ......
Read more >
A Step-by-Step Guide to Building and Deploying Google ...
You can write functions in the Google Cloud Platform console or write them locally and deploy using Google Cloud tooling on your local...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found