Open ivanbarlog opened 6 years ago
@ivanbarlog What is the command you are running when you hit this error?
@ivanbarlog Also, just noticed you are using webpack. Might be this issue here? https://github.com/rurri/serverless-resources-env/issues/10
Seems a directory changes during pre-build and post-build.
Hi @rurri I am running into this problem after sls deploy
. I've tried to sls remove
it before running sls deploy
but the result was the same.
Finally I've resolved my issue by using another way of "importing" CloudFormation data into my ENV variables which is described in the link above. Before I was trying to use it with no luck because I was exporting the Output with its name and within ${cf: ... }
I was calling the exported name not the actual name of my resource like this:
service:
name: ${opt:name, 'sample'}
publish: false
plugins:
- serverless-appsync-plugin
- serverless-webpack
provider:
name: aws
runtime: nodejs8.10
region: eu-west-1
stage: ${opt:stage, 'dev'}
profile: ${opt:aws-profile, 'default-profile'}
environment:
# this here didn't worked
MY_VAR: ${cf:${self:service}-${self:provider.stage}.UserPoolId-${self:service}-${self:provider.stage}}
functions:
someFunction:
handler: handler.someHandler
resources:
CognitoUserPoolUserPool:
Type: AWS::Cognito::UserPool
Properties:
- someProperties
# ...
Outputs:
UserPoolId:
Value:
Ref: CognitoUserPoolUserPool
Export:
# in above ${cf: ... } I was using this name as identifier instead of Output identifier
Name: "UserPoolId-${self:service}-${self:provider.stage}"
So in this case I have resolved it by avoiding serverless-resources-env
plugin altogether using following as ${cf: ... }
identifier:
# ...
provider:
environment:
# this here didn't worked
MY_VAR: ${cf:${self:service}-${self:provider.stage}.UserPoolId}
# ...
The usage haven't really be clear for me after 100 times of reading the documentation and reading through GitHub issues whole day. Hopefully this issue helps someone in the future.
Also I don't think that this has anything to do with serverless-webpack
since I haven't been running invoke local
but I was trying to deploy the infrastructure.
Thanks for help anyway ;-)
Well now I am confused.
I've removed my stack by sls remove
and after no changes whatsoever (yesterday it worked as charm) now I am getting Stack with id sample-dev does not exist
again. Well, I understand, that when I remove the stack it does not exist but how can I add the Cloud Formation ID to my ENV variables?
Do I need to comment that line of code, deploy my stack and then redeploy it after un-commenting that line?
That fortunately worked but I don't think that it is very practical. Any suggestions?
Hi, I am trying to use your plugin but I have encountered following error for the service called
sample
with stagedev
:My
serverless.yml
config is bit longer so I am including only important parts:Do you know where the problem can be? When I remove your plugin from the configuration it works but also I need it so I have Cognito's UserPoolId within my Lambda function. Before trying your plugin I have tried reference it manually via CloudFormation output (https://serverless.com/framework/docs/providers/aws/guide/variables/#reference-cloudformation-outputs) which is probably what the plugin does in the background but with no luck - there was the same error.
Any idea? I am not sure how exactly the CloudFormation stack ID works related to the serverless stages.
Thanks for any help