title: Google cloud app engine flex environment deployment failure (NestJS) - Error code 13 (Internal Error Occurred)
body: <p>I've done a lot of researching on this error and found some posts here and on github but none of the resolutions they suggest are working for me.  I'm receiving a pretty ambiguous error when trying to deploy my application to a flex environment on google cloud service app engine.</p>
  <p>It works fine when I deploy to a standard app service in the app engine, but when I try to deploy to a flex service I receive this error:</p>
  <blockquote>
  <p>ERROR: (gcloud.app.deploy) Error Response: [13] An internal error occurred during deployment.</p>
  </blockquote>
  <p>I know it is nothing wrong with my application code nor my app.yaml because when I do the same deployment on another google cloud account, the service deploys fully, publishes, and I'm able to use the API.  It is definitely something failing with my google cloud setup for this specific account.  I'm pretty confident that I have all of the apis enabled and correct service account roles applied to this account that is not working, but obviously something is different.</p>
  <p>One suggestion I read was to apply the role &quot;App Engine flexible environment Service Agent&quot; to my app engine default service account.  That role did not exist on my other account that is working, but I tried anyway - no joy.</p>
  <p>Here are my roles assigned to my service accounts on both my working google cloud account, and the non-working one.</p>
  <p><a href="https://i.stack.imgur.com/yJyGj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yJyGj.jpg" alt="enter image description here" /></a></p>
  <p>Here is a comparison between my enabled APIs on both accounts:</p>
  <p><a href="https://i.stack.imgur.com/oEHSu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oEHSu.png" alt="enter image description here" /></a></p>
  <p>I set both of these cloud accounts up and I do not recall doing anything differently for the one that is working than I did for the one that is not.</p>
  <p>I've tried deploying through my cloud build trigger and manually running <code>gcloud app deploy</code>.</p>
  <p>I also tried the latter with --verbosity=debug which gives me only a little more information about the failure:</p>
  <pre><code>&quot;done&quot;: true,
  &quot;error&quot;: {
      &quot;code&quot;: 13,
      &quot;message&quot;: &quot;An internal error occurred during deployment.&quot;
  },
  &quot;metadata&quot;: {
      &quot;@type&quot;: &quot;type.googleapis.com/google.appengine.v1.OperationMetadataV1&quot;,
      &quot;endTime&quot;: &quot;2022-08-14T00:25:57.780Z&quot;,
      &quot;insertTime&quot;: &quot;2022-08-14T00:25:54.623Z&quot;,
      &quot;method&quot;: &quot;google.appengine.v1.Versions.CreateVersion&quot;,
      &quot;target&quot;: &quot;apps/my-app/services/your-app/versions/20220814t002258&quot;,
      &quot;user&quot;: &quot;me@you.com&quot;
  },
  </code></pre>
  <p>This is a resource I've found similar to my issue: <a href="https://github.com/GoogleCloudPlatform/nodejs-getting-started/issues/153" rel="nofollow noreferrer">https://github.com/GoogleCloudPlatform/nodejs-getting-started/issues/153</a></p>
  <p>I've tried every suggestion there and still having the problem.</p>
  <p>I'm 100% certain it's not the code itself nor the app.yaml because it works fine on my other account.  Any other suggestions of places to look would be greatly appreciated.</p>
  <p>TIA</p>