title: Google cloud function permission problems
body: <p>I have two projects in GCP, let’s say project A and B. Project A is newly created, and project B is two years old. When I create a cloud function in project A, it’s created with the default services account (project@appspot…). However, when I create a cloud function on project B, a non existing service account is used. I know it doesn’t exist because it doesn’t appear on the IAM. </p>
  
  <p>In the project A the cloud function created can access the datastore, however, the same cloud function in the project B isn’t able to access the datastore. </p>
  
  <p>So, my questions are:</p>
  
  <ol>
  <li><p>How can I know which google services account will be used by a cloud function? </p></li>
  <li><p>Is there a way to change the used service account by project B to have a cloud function that access the datastore?</p></li>
  </ol>
  
  <p>I have tried to give the appropriate permissions to the cloud function, but as long as is in project B it doesn’t work. What am I missing here?</p>