{"action":"created","issue":{"url":"https://api.github.com/repos/MartinSahlen/cloud-functions-python/issues/46","repository_url":"https://api.github.com/repos/MartinSahlen/cloud-functions-python","labels_url":"https://api.github.com/repos/MartinSahlen/cloud-functions-python/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/MartinSahlen/cloud-functions-python/issues/46/comments","events_url":"https://api.github.com/repos/MartinSahlen/cloud-functions-python/issues/46/events","html_url":"https://github.com/MartinSahlen/cloud-functions-python/issues/46","id":309360590,"number":46,"title":"finished with status code: 500","user":{"login":"santhoshdc1590","id":30614728,"avatar_url":"https://avatars2.githubusercontent.com/u/30614728?v=4","gravatar_id":"","url":"https://api.github.com/users/santhoshdc1590","html_url":"https://github.com/santhoshdc1590","followers_url":"https://api.github.com/users/santhoshdc1590/followers","following_url":"https://api.github.com/users/santhoshdc1590/following{/other_user}","gists_url":"https://api.github.com/users/santhoshdc1590/gists{/gist_id}","starred_url":"https://api.github.com/users/santhoshdc1590/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santhoshdc1590/subscriptions","organizations_url":"https://api.github.com/users/santhoshdc1590/orgs","repos_url":"https://api.github.com/users/santhoshdc1590/repos","events_url":"https://api.github.com/users/santhoshdc1590/events{/privacy}","received_events_url":"https://api.github.com/users/santhoshdc1590/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-28T13:11:24Z","updated_at":"2018-03-29T10:06:34Z","closed_at":null,"author_association":"NONE","body":"I was successful in running the python code I want by deploying it on cloud function. 🎉🎉🎉🎉\r\n\r\nThis is my `function.py` file content.\r\n\r\n```\r\nfrom FTUL import mainP\r\nfrom cloudfn.google_account import get_credentials\r\nfrom cloudfn.http import handle_http_event, Response\r\nfrom google.cloud import bigquery\r\nimport json\r\n\r\ndef handle_http(req):\r\n    \r\n    biquery_client = bigquery.Client(credentials=get_credentials())\r\n       \r\n    if req.method == 'POST':\r\n        #extract information from the body of the POST request\r\n        rBody = json.loads(req.body)\r\n        im = rBody['image']\r\n        rID = rBody['refID']\r\n        rTable = rBody['refTable']\r\n        # Do the required operation from the extracted info\r\n        mainP(im,rID,rTable)\r\n\r\n        return Response(\r\n            status_code=200,\r\n        )\r\n\r\n\r\nhandle_http_event(handle_http)\r\n```\r\n\r\nThe cloud function runs as expected, but always ends with error code `500`\r\n\r\nWhen I check the logs of google.\r\n\r\nthis is what is being printed\r\n\r\n> {\r\n>  insertId:  \"some code\"   \r\n>  labels: {\r\n>   execution_id:  \"some id\"    \r\n>  }\r\n>  logName:  \"projects/network-api-production/logs/cloudfunctions.googleapis.com%2Fcloud-functions\"   \r\n>  receiveTimestamp:  \"2018-03-28T11:34:48.880241330Z\"   \r\n>  resource: {\r\n>   labels: {\r\n>    function_name:  \"handle_http\"     \r\n>    project_id:  \"network-api-production\"     \r\n>    region:  \"us-central1\"     \r\n>   }\r\n>   type:  \"cloud_function\"    \r\n>  }\r\n>  severity:  \"DEBUG\"   \r\n>  textPayload:  \"Function execution took 5026 ms, finished with status code: 500\"   \r\n>  timestamp:  \"2018-03-28T11:34:43.524350461Z\"   \r\n\r\n`severity: \"DEBUG\"` can be seen here in [LogSeverity](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#logseverity) as `(100) Debug or trace information`\r\n\r\nCan anyone help me resolve the issue?"},"comment":{"url":"https://api.github.com/repos/MartinSahlen/cloud-functions-python/issues/comments/377188124","html_url":"https://github.com/MartinSahlen/cloud-functions-python/issues/46#issuecomment-377188124","issue_url":"https://api.github.com/repos/MartinSahlen/cloud-functions-python/issues/46","id":377188124,"user":{"login":"santhoshdc1590","id":30614728,"avatar_url":"https://avatars2.githubusercontent.com/u/30614728?v=4","gravatar_id":"","url":"https://api.github.com/users/santhoshdc1590","html_url":"https://github.com/santhoshdc1590","followers_url":"https://api.github.com/users/santhoshdc1590/followers","following_url":"https://api.github.com/users/santhoshdc1590/following{/other_user}","gists_url":"https://api.github.com/users/santhoshdc1590/gists{/gist_id}","starred_url":"https://api.github.com/users/santhoshdc1590/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santhoshdc1590/subscriptions","organizations_url":"https://api.github.com/users/santhoshdc1590/orgs","repos_url":"https://api.github.com/users/santhoshdc1590/repos","events_url":"https://api.github.com/users/santhoshdc1590/events{/privacy}","received_events_url":"https://api.github.com/users/santhoshdc1590/received_events","type":"User","site_admin":false},"created_at":"2018-03-29T10:06:34Z","updated_at":"2018-03-29T10:06:34Z","author_association":"NONE","body":"Error `SyntaxError: Unexpected token # in JSON at position 4 at Object.parse (native) at shimHandler.then (/user_code/index.js:84:17) at process._tickDomainCallback (internal/process/next_tick.js:135:7)`\r\n\r\nsolution [link1](https://stackoverflow.com/questions/37948990/syntaxerror-unexpected-token-in-json-at-position-0-at-object-parse-native) [link2](https://stackoverflow.com/questions/44176194/json-parse-causes-error-syntaxerror-unexpected-token-in-json-at-position-0) still not working\r\n"}}
{"actor":{"display_login":"santhoshdc1590"}}