Skip to content

serverless-plugin-split-stacks: AppSync Api not found in stack. Did you forget to deploy? #594

@owain68

Description

@owain68

I am getting the error AppSync Api not found in stack. Did you forget to deploy?.

Here is the environment and output.

✖ Stack tech-xxxxxx-dev failed to deploy (1353s)
Environment: darwin, node 18.13.0, framework 3.27.0 (local), plugin 6.2.3, SDK 4.3.2
Credentials: Local, "wgv-app-dev" profile
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues

Error:
AppSync Api not found in stack. Did you forget to deploy?

I am trying to migrate from V1 of the plugin using the migration guide.

All the resources appear to deploy for a short period of time before a ROLLBACK is issued. And then they disappear. I suspect that the Rollback is initiated by the serverless framework itself since the appsync plugin throws this error.

async getApiId() {
   this.loadConfig();

   if (!this.naming) {
     throw new this.serverless.classes.Error(
       'Could not find the naming service. This should not happen.',
     );
   }

   const logicalIdGraphQLApi = this.naming.getApiLogicalId();

   const { StackResources } = await this.provider.request<
     DescribeStackResourcesInput,
     DescribeStackResourcesOutput
   >('CloudFormation', 'describeStackResources', {
     StackName: this.provider.naming.getStackName(),
     LogicalResourceId: logicalIdGraphQLApi,
   });

   const apiId = last(StackResources?.[0]?.PhysicalResourceId?.split('/'));

   if (!apiId) {
     throw new this.serverless.classes.Error(
       'AppSync Api not found in stack. Did you forget to deploy?',
     );
   }

   return apiId;
 }

So apiId is not found for some reason which throws an exception.

I am probably missing something in my serverless.yml or do I need to explicitly Output some CloudFormation values to fix this.

Here is the header of my serverless yml file.

appSync:
  name: "${self:service}-${self:provider.stage}"
  authentication:
    type: AMAZON_COGNITO_USER_POOLS
    config:
      awsRegion: ${self:provider.region}
      defaultAction: ALLOW
      userPoolId:
        Fn::ImportValue: ${self:custom.resources.PROJECT_PREFIX}-UserPoolId
  additionalAuthentications:
    - type: API_KEY
  apiKeys:
    - name: Default-${self:provider.stage}
      description: Default-${self:provider.stage} generated by Serverless deployment
      expiresAfter: 1y
      apiKeyId: ${self:custom.resources.APPSYNC_API_KEY}
....

It would be very helpful if there is a working example available to compare with.

Thanks in advance.

O.,

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions