title: How to troubleshoot 'File...does not exist!' error (code 403) in gcloud
body: <p>I'm trying to execute some sample code from <a href="https://cloud.google.com/speech-to-text/docs/quickstart-protocol?hl=en_US&amp;_ga=2.166114684.-373869418.1554295135&amp;_gac=1.250872370.1554909481.EAIaIQobChMIjuv1lunF4QIVkLjACh3-RAlSEAAYASAAEgIayPD_BwE&amp;authuser=1" rel="nofollow noreferrer">cloud.googe.com</a> that converts a sample audio file to text, but I'm getting an error message that doesn't make sense.</p>
  
  <p>I've gone through all the steps indicated:</p>
  
  <ul>
  <li>Create Project</li>
  <li>Enable Speech to Text API</li>
  <li>Create a service account</li>
  <li>download private key as a JSON file</li>
  <li>I open up Terminal (Version 2.9.4 (421.1.1)) MacOS 10.14.4</li>
  <li>I execute the following code in order to set the environment variable:
  <code>export GOOGLE_APPLICATION_CREDENTIALS="[PATH]"</code> (with path being the location of the JSON file I downloaded)</li>
  <li>I then create the JSON request file they say to create, which is basically the instructions to get to the sample audio file.</li>
  <li>Then I execute the following code after initializing gcloud and making sure I'm in the same directory that contains the JSON request file that I created:</li>
  </ul>
  
  <pre><code>curl -s -H "Content-Type: application/json" \
      -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
      https://speech.googleapis.com/v1/speech:recognize \
      -d @sync-request.json
  </code></pre>
  
  <p>So then, instead of getting the response that the tutorial page says I will get, I get an error message that is not on GCP's help page:</p>
  
  <pre><code>ERROR: (gcloud.auth.application-default.print-access-token) File /pathofFile/nameofFile.json (pointed by GOOGLE_APPLICATION_CREDENTIALS environment variable) does not exist!
  {
    "error": {
      "code": 403,
      "message": "The request is missing a valid API key.",
      "status": "PERMISSION_DENIED"
    }
  }
  </code></pre>
  
  <p>This error is obviously not due to me failing to set the environment variable because the error message says "(pointed by GOOGLE_APPLICATION_CREDENTIALS environment variable)," and the error message is displaying the correct path of the correct JSON credential file. The JSON credential file is for sure there; I can see it in finder.</p>
  
  <p>What could be going wrong here?</p>
  
  <p><strong>Edit</strong>: When I tried running 
  <code>gcloud auth application-default login</code>
  or
  <code>gcloud auth application-default print-access-token</code>,
  I got the error message <code>gcloud: command not found</code></p>
  
  <p>So it looks like I didn't have the Cloud SDK fully installed. Now I'm wondering which of the SDK's components I need to install in order to complete this task. Which of the following would I need to install?</p>
  
  <pre><code>The latest available version is: 246.0.0
  
  ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
  │                                                   Components                                                   │
  ├──────────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤
  │      Status      │                         Name                         │            ID            │    Size   │
  ├──────────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤
  │ Update Available │ BigQuery Command Line Tool                           │ bq                       │   &lt; 1 MiB │
  │ Update Available │ Cloud SDK Core Libraries                             │ core                     │  10.5 MiB │
  │ Not Installed    │ App Engine Go Extensions                             │ app-engine-go            │  56.4 MiB │
  │ Not Installed    │ Cloud Bigtable Command Line Tool                     │ cbt                      │   6.3 MiB │
  │ Not Installed    │ Cloud Bigtable Emulator                              │ bigtable                 │   5.6 MiB │
  │ Not Installed    │ Cloud Datalab Command Line Tool                      │ datalab                  │   &lt; 1 MiB │
  │ Not Installed    │ Cloud Datastore Emulator                             │ cloud-datastore-emulator │  18.4 MiB │
  │ Not Installed    │ Cloud Datastore Emulator (Legacy)                    │ gcd-emulator             │  38.1 MiB │
  │ Not Installed    │ Cloud Firestore Emulator                             │ cloud-firestore-emulator │  40.5 MiB │
  │ Not Installed    │ Cloud Pub/Sub Emulator                               │ pubsub-emulator          │  34.8 MiB │
  │ Not Installed    │ Cloud SQL Proxy                                      │ cloud_sql_proxy          │   3.7 MiB │
  │ Not Installed    │ Emulator Reverse Proxy                               │ emulator-reverse-proxy   │  14.5 MiB │
  │ Not Installed    │ Google Cloud Build Local Builder                     │ cloud-build-local        │   5.9 MiB │
  │ Not Installed    │ Google Container Registry's Docker credential helper │ docker-credential-gcr    │   1.8 MiB │
  │ Not Installed    │ gcloud Alpha Commands                                │ alpha                    │   &lt; 1 MiB │
  │ Not Installed    │ gcloud Beta Commands                                 │ beta                     │   &lt; 1 MiB │
  │ Not Installed    │ gcloud app Java Extensions                           │ app-engine-java          │ 105.6 MiB │
  │ Not Installed    │ gcloud app PHP Extensions                            │ app-engine-php           │  21.9 MiB │
  │ Not Installed    │ gcloud app Python Extensions                         │ app-engine-python        │   6.0 MiB │
  │ Not Installed    │ gcloud app Python Extensions (Extra Libraries)       │ app-engine-python-extras │  28.5 MiB │
  │ Not Installed    │ kubectl                                              │ kubectl                  │   &lt; 1 MiB │
  │ Installed        │ Cloud Storage Command Line Tool                      │ gsutil                   │   3.8 MiB │
  └──────────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘
  To install or remove components at your current SDK version [245.0.0], run:
    $ gcloud components install COMPONENT_ID
    $ gcloud components remove COMPONENT_ID
  </code></pre>
  
  <p><strong>Edit</strong>:
  Thanks so much for the help everyone. I ended up reinstalling the SDK. Before I had installed the SDK by first downloading the files and then running 
  <code>./google-cloud-sdk/install.sh</code></p>
  
  <p>But this time I deleted all of the SDK files on my computer and ran
  <code>curl https://sdk.cloud.google.com | bash</code>
  Besides that, I made sure to save the "google-cloud-sdk" directory to my root directory, which made it so I could use the default .rc file path.</p>