GoogleCloudPlatform / data-science-on-gcp

Source code accompanying book: Data Science on the Google Cloud Platform, Valliappa Lakshmanan, O'Reilly 2017
Apache License 2.0
1.31k stars 715 forks source link

Chapter 2 - Optional Tasks #89

Closed andresgalarza-astro closed 4 years ago

andresgalarza-astro commented 4 years ago

Hello there! I'm currently following this tutorial and when I ran ./deploy_cf.sh after setting the token and modifying it on main.py I got the following error

ingest_flights_vNdUIIMPCAy5v8715MV361o4TTdDBssZ Allow unauthenticated invocations of new function [ingest_flights_vNdUIIMPCAy5v8715MV361o4TTdDBssZ]? (y/N)? y Deploying function (may take a while - up to 2 minutes)...failed. ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Function failed on loading user code. Error message: File main.py is expected to contain a functi on named ingest_flights_vNdUIIMPCAy5v8715MV361o4TTdDBssZ

ryanjclark commented 4 years ago

Same issue here

brenterprises commented 4 years ago

Is the issue that we need to rename the function after the new token? So we have to manually rename the function in main.py as the new token?

AttributeError: module 'main' has no attribute 'ingestflights'

kaijennissen commented 4 years ago

One solution is to add the --entry-point flag with ingest_flights as value to the deploy_cf.sh and specify . gcloud functions deploy $URL --entry-point ingest_flights --runtime python37 --trigger-http --timeout 480s

lakshmanok commented 4 years ago

Thanks, can you submit a pull request with the change?

On Mon, Oct 5, 2020, 1:24 AM kja notifications@github.com wrote:

One solution is to add the --entry-point flag to the deploy_cf.sh. gcloud functions deploy $URL --entry-point ingest_flight --runtime python37 --trigger-http --timeout 480s

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/data-science-on-gcp/issues/89#issuecomment-703482180, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANJPZZ34LB5A3PP6KSOSL3SJF7DXANCNFSM4MVV7FVA .