Ad
Missing Handler Error On Lambda But Handler Exists In Script
My lambda_function.py
file looks like this:
from urllib.request import urlopen
from google.cloud import bigquery
import json
url = "https://data2.unhcr.org/population/get/timeseries?widget_id=286725&sv_id=54&population_group=5460&frequency=day&fromDate=1900-01-01"
bq_client = bigquery.Client()
def lambda_helper(event, context):
response = urlopen(url)
data_json = json.loads(response.read())
bq_client.load_table_from_json(data_json['data']['timeseries'], "xxx.xxxx.tablename")
But every time I zip it up and upload it to my Lambda I get this error:
{
"errorMessage": "Handler 'lambda_handler' missing on module 'lambda_function'",
"errorType": "Runtime.HandlerNotFound",
"stackTrace": []
}
Is there a reason this error would be thrown even though I clearly have that function written in this module? This is driving me nuts. Thanks for any help!
Ad
Answer
It should be:
def lambda_handler(event, context):
not
def lambda_helper(event, context):
Ad
source: stackoverflow.com
Related Questions
- → AWS SDK with Lumen
- → Using AWS Certificate with a parked domain for a shopify store
- → laravel or AWS don't detect my https
- → S3 putObject callback not returning expected objects
- → Amazon S3 image hosting with Shopify
- → Redirection to https not working using AWS Elastic Beanstalk
- → Shopify app showing request blocked by an extension
- → AWS Iam commands, Working correct in terminal and not working in Laravel/PHP AWS SDK
- → Violates the following Content Security Policy directive: *** in Shopify
- → AWS S3 cannot delete objects in bucket via PHP SDK
- → Laravel s3 multiple buckets
- → AWS IoT private.pem.key doesn't exist
- → Supervise queue in laravel 5.1
Ad