title: Firebase Cloud Functions - Can't get a working signed URL for file in emulated Firebase Storage
body: <p>I'm currently building a basic API for use across various applications using Firebase, as I want to avoid cluttering the UI code with the standard Firebase functions.</p>
  <p>I'm building the API in the Firebase Functions NodeJS environment locally, testing using the firebase emulators.</p>
  <p>On trying to get a signed URL for a file uploaded to Firebase Storage (emulator) I'm successfully getting a URL returned from my API, however when I try to view the URL in my browser I get the following message:</p>
  <blockquote>
  <p>*****@appspot.gserviceaccount.com does not have storage.objects.get access to the Google Cloud Storage object.</p>
  </blockquote>
  <p>I've been fiddling with service accounts and IAM roles for several days now, and I'm going round in circles. The current attached service account has the following roles in Cloud Console IAM section:</p>
  <ul>
  <li>Cloud Storage for Firebase Admin</li>
  <li>Editor</li>
  <li>Service Account Token Creator</li>
  <li>Storage Object Admin</li>
  </ul>
  <p>Here is my cloud function I'm using to retrieve the signed URL:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>get_avatar = (id) =&gt; {
      try {
          const expiry_date = '06-14-2022';
          const config = {
              action: 'read',
              expires: expiry_date
          };
  
          return this.bucket.file(`${id}/avatar`).getSignedUrl(config).then((data) =&gt; data[0]);
      } catch(error) {
          throw new Error(error);
      }
  }</code></pre>
  </div>
  </div>
  </p>