Category : google-cloud-functions

Below google cloud function runs fine locally but fails when deployed on the cloud. from flask import escape import functions_framework import numpy as np @functions_framework.http def test_func(request): np_array = np.zeros(172128250, dtype=np.complex64) print(‘np_array shape: ‘, np_array.shape) abs_array = np.abs(np_array) print(‘abs_array shape: ‘, abs_array.shape) return ‘Hello World’ Python versions tried: 3.7, 3.8, and 3.9. Timeout: 540s Memory: ..

Read more

Below google cloud function runs fine locally but fails when deployed on the cloud. from flask import escape import functions_framework import numpy as np @functions_framework.http def test_func(request): np_array = np.zeros(172128250, dtype=np.complex64) print(‘np_array shape: ‘, np_array.shape) abs_array = np.abs(np_array) print(‘abs_array shape: ‘, abs_array.shape) return ‘Hello World’ Python versions tried: 3.7, 3.8, and 3.9. Timeout: 540s Memory: ..

Read more

I’m trying to append multiple rows at once in a Google Sheets (via API from Google Cloud). Right now, my functions to connect and append are: def connect_to_gsheet(data): # Create a connection object. credentials = service_account.Credentials.from_service_account_info( data, scopes=[SCOPE], ) service = build("sheets", "v4", credentials=credentials) gsheet_connector = service.spreadsheets() return gsheet_connector def add_row_to_gsheet(gsheet_connector, sheet_name, row) -> None: ..

Read more

I am trying to deploy the below mentioned python code in gcp cloud function, it fails. Error: ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation ..

Read more

I’m writing a cloud function to extract data from an API in the following format: [{‘_id’: ‘123qasd’, ‘description’: ‘stuff here’, ‘userId’: ‘xxxx’, ‘billable’: False, ‘taskId’: ‘asddf1234’, ‘projectId’: ‘5e11gg55’, ‘timeInterval’: {‘start’: ‘2020-05-16T09:00:00+02:00’, ‘end’: ‘2020-05-16T13:00:00+02:00’, ‘duration’: 14400}, ‘taskName’: ‘Production’, ‘tags’: [], ‘isLocked’: True, ‘customFields’: [], ‘userName’: ‘Dupond’, ‘userEmail’: ‘[email protected]’, ‘projectName’: ‘my project’, ‘projectColor’: ‘#607D8B’, ‘clientName’: ‘my client’, ..

Read more

I try to connect from a Google Cloud Function in Python runtime to an external MySQL server db that is not hosted by Google Cloud. My "requirements.txt": # Function dependencies, for example: # package>=version SQLAlchemy>=1.4.2 PyMySQL==1.0.2 The Cloud Function core script: db_user = environ["DB_USER"] db_pass = environ["DB_PASS"] db_name = environ["DB_NAME"] db_host = environ["DB_HOST"] db_port = ..

Read more

I’m running a cloud function in python to return some data from an api. The function is not executed and I have the error {‘code’: 400, ‘message’: ‘Could not parse JSON’}. Here is my code: import requests import json def my_function(request): url = ‘https://blablabla/detailed’ headers = {‘X-Api-Key’: ‘XXXXXXXX’, ‘content-type’: ‘application/json’} data = ‘{"dateRangeStart":"2020-05-10T00:00:00.000","dateRangeEnd":"2020-05-16T23:59:59.000","amountShown": "HIDE_AMOUNT","detailedFilter":{ "page":"1","pageSize":"50"}}’ ..

Read more