Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.
This repository was archived by the owner on May 1, 2020. It is now read-only.

remove() is not removing an AppSync API #15

@veloware

Description

@veloware

I have the following serverless.js for a POC, that will create a dynamodb table for storing posts and an AppSync API for creating a post and getting all posts -

const { Component } = require('@serverless/core');

class ServerlessTemplate extends Component {
    async default(inputs) {
        inputs.env = inputs.env || 'dev';

        const template = await this.load('@serverless/template', inputs.env);

        return await template({
            template: {
                name: inputs.name,
                postsTable: {
                    component: '@serverless/aws-dynamodb',
                    inputs: {
                        name: `posts-${inputs.env}`,
                        region: 'eu-west-1'
                    }
                },
                appSync: {
                    component: '@serverless/aws-app-sync',
                    inputs: {
                        name: `posts-api-${inputs.env}`,
                        region: 'eu-west-1',
                        authenticationType: 'API_KEY',
                        apiKeys: ['myApiKey'],
                        dataSources: [{
                            type: 'AMAZON_DYNAMODB',
                            name: 'Posts',
                            config: {
                                tableName: `posts-${inputs.env}`
                            }
                        }],
                        mappingTemplates: [{
                            dataSource: 'Posts',
                            type: 'Mutation',
                            field: 'addPost',
                            request: 'addPostRequest.vtl',
                            response: 'addPostResponse.vtl'
                        }, {
                            dataSource: 'Posts',
                            type: 'Query',
                            field: 'posts',
                            request: 'getAllPostsRequest.vtl',
                            response: 'getAllPostsResponse.vtl'
                        }]
                    }
                }
            }
        });
    }

    async remove(inputs) {
        inputs.env = inputs.env || 'dev';
        const template = await this.load('@serverless/template', inputs.env);
        console.log(template);
        await template.remove();
        return {};
    }
}

module.exports = ServerlessTemplate;

sls --env dev will create the resources correctly - however running sls remove --env dev will only remove the dynamodb table, but not the AppSync API. Not sure if this is a bug or if I have missed something in my config?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions