Git Product home page Git Product logo

Comments (4)

rurri avatar rurri commented on September 14, 2024

@ivanbarlog What is the command you are running when you hit this error?

from serverless-resources-env.

rurri avatar rurri commented on September 14, 2024

@ivanbarlog Also, just noticed you are using webpack. Might be this issue here?
#10

Seems a directory changes during pre-build and post-build.

from serverless-resources-env.

ivanbarlog avatar ivanbarlog commented on September 14, 2024

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 ;-)

from serverless-resources-env.

ivanbarlog avatar ivanbarlog commented on September 14, 2024

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?

from serverless-resources-env.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.