diff --git a/src/google-cloud/client.ts b/src/google-cloud/client.ts index fd44e352..dc44fcd6 100644 --- a/src/google-cloud/client.ts +++ b/src/google-cloud/client.ts @@ -166,10 +166,14 @@ export class Client { ): boolean { let isAuthorizationError = false; - if ( - (err.response?.status === 403 || err.status === 403) && - !isQuotaLimitError(err) - ) { + const status = + err.response?.status !== undefined ? err.response?.status : err.status; + + /** + * 404 is usually not a permission issue. In this case, when a user doesn't have access to a + * specific resource it will return a 404 status code, when its a permission issue. + */ + if ((status == 403 || status == 404) && !isQuotaLimitError(err)) { isAuthorizationError = true; if ( diff --git a/src/steps/resource-manager/index.ts b/src/steps/resource-manager/index.ts index 88b1ae20..9a786ced 100644 --- a/src/steps/resource-manager/index.ts +++ b/src/steps/resource-manager/index.ts @@ -292,10 +292,12 @@ export async function fetchResourceManagerSkippedProjects( ) { const projectEntity = createProjectEntity(client.projectId, project); + logger.info( + `Adding skipped project to jobState: ${projectEntity._key}`, + ); + if (!jobState.hasKey(projectEntity._key)) { - await jobState.addEntity( - createProjectEntity(client.projectId, project), - ); + await jobState.addEntity(projectEntity); } } }