serverless-appsync-plugin icon indicating copy to clipboard operation
serverless-appsync-plugin copied to clipboard

Substitution issue when serverless-appsync-plugin is installed global

Open hofline opened this issue 4 years ago • 3 comments

npm install -g serverless-appsync-plugin

slslog

sls deploy --stage test --region $AWS_DEFAULT_REGION --account acc-qa Serverless: Packaging service... Serverless: Uploading CloudFormation file to S3... Serverless: Uploading artifacts... Serverless: Uploading service deploy.zip file to S3 (8.02 MB)... Serverless: Validating template...

Error --------------------------------------------------

Error: The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [apistage] in the Resources block of the template at provider.request.catch.error (/usr/lib/node_modules/serverless/lib/plugins/aws/deploy/lib/validateTemplate.js:20:13) at tryCatcher (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:725:18) at _drainQueueStep (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:102:5) at Immediate.Async.drainQueues [as _onImmediate] (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:15:14) at runCallback (timers.js:763:18) at tryOnImmediate (timers.js:734:5) at processImmediate (timers.js:716:5) at process.topLevelDomainCallback (domain.js:102:23)

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues Issues: forum.serverless.com

Your Environment Information --------------------------- Operating System: linux Node Version: 9.11.2 Framework Version: 1.71.1 Plugin Version: 3.6.12 SDK Version: 2.3.0 Components Version: Unavailable

serverless.yml

appSync: name: ${self:service}-${self:provider.stage} ... mappingTemplates: ... functionConfigurations: ...
dataSources: ... substitutions: ----APISTAGE: ${opt:stage}

delete_template.vt

#set($apistage = "${APISTAGE}") { "version":"2018-05-29", "method":"DELETE", "params": { "headers": { "Content-Type": "application/json" } }, "resourcePath": "/${apistage}/v1/operation/id/${ctx.args.id}" }

hofline avatar May 22 '20 13:05 hofline

@hofline not sure if this is a copy/paste issue, but it looks like that there is an indentation issue here:

substitutions:
APISTAGE: ${opt:stage}

Also, substitution is case sensitive: your substitunaiton name is APISTAGE but you are using ${apistage} in the template.

bboure avatar May 22 '20 18:05 bboure

Hello @bboure thanks for replay. No that was ident. issue when copy/paste

substitutions: ----APISTAGE: ${opt:stage}

This issue is solved when I install serverless-appsync-plugin in local directory. I don't know why!

Thank you!

hofline avatar May 22 '20 19:05 hofline

Could check or share the resulting cloudformation template under the .serveless directory?

See if there is something weird in the template contents.

bboure avatar May 22 '20 19:05 bboure