10

I'm new using Google's APIs.

I'm following step by step the next tutorial made by Google: https://cloud.google.com/functions/docs/tutorials/ocr

I want to deploy a specific function provided by Google (the processImage function).

I entered this into the console:

gcloud alpha functions deploy ocr-extract --stage-bucket [YOUR_STAGING_BUCKET_NAME] --trigger-bucket [YOUR_IMAGE_BUCKET_NAME] --entry-point processImage

But it gives me this error:

Error: (gcloud.alpha.functions.deploy) ResponseError: status=[403], code=[Forbidden], message=[Cannot access Google Cloud Functions API in project
ggorlen
  • 44,755
  • 7
  • 76
  • 106
DavidQuezada7
  • 149
  • 2
  • 7
  • Did you enable cloud functions on cloud.google.com? And, is your account whitelisted for access by Google? – xrd Nov 20 '16 at 06:31
  • Thank you for your reply. Yes I already enabled the necesary API's and I filled the form for being whitelisted. My questions is, do I have to do something else that does not appear in the tutorial of OCR provided by google. https://cloud.google.com/functions/docs/tutorials/ocr I will really appreciate your help. – DavidQuezada7 Nov 22 '16 at 18:20
  • Just to be sure, you aren't actually using YOUR_STAGING_BUCKET_NAME in the command? You are replacing that with your real bucket name, right? – xrd Nov 22 '16 at 18:22
  • Yes, I renamed it to "stagingbucketlatert" (latert is the name of my proj). BTW I think it is problem of credentials, in that tutorial I am not asked to add credentials wich is weird for me, I think.. I have doubts in just one step of that tutorial and is where I config the conf.json file. I am not pretty sure what is a "YOUR_RESULT_TOPIC_NAME" I just put a name... – DavidQuezada7 Nov 22 '16 at 20:47
  • May be it could sound stupid but I am not pretty sure in what moment do I use the file index.js provided by google?? because in that file I saw that they made the requests and permisions. – DavidQuezada7 Nov 22 '16 at 21:01

3 Answers3

11

I faced the same error. It got resolved once I did gcloud init in my command prompt terminal. Mentioned command linked my GCP project to the folder where my files were present. After that command mentioned by you worked.

Pratik Kaje
  • 685
  • 8
  • 23
  • 2
    This works. An alternative is to use `gcloud auth revoke` and then `gcloud auth login` to authenticate the desired account. – Mike S. Jun 29 '18 at 19:31
2

You should Initialize the SDK first.

  1. run gcloud init
  2. config your login account and select your project name.
Joe
  • 811
  • 1
  • 8
  • 14
0

it might be silly but be sure to enable the cloud functions api in your project settings on the gcloud dashboard website.

enter image description here

MadeByDouglas
  • 2,509
  • 1
  • 18
  • 22