GithubHelp home page GithubHelp logo

Value not found at "self" source about examples HOT 8 OPEN

FelCer avatar FelCer commented on June 9, 2024 8
Value not found at "self" source

from examples.

Comments (8)

pgrzesik avatar pgrzesik commented on June 9, 2024 11

Hello @FelCer - in fact, this example has a bit of a bug when it comes to it's configuration.

The best way to address it would be to replace ${opt:stage, self:provider.stage} with ${sls:stage} variable and ${opt:region, self:provider.region} with ${aws:region} variables.

Introducing changes as proposed above should resolve the problem.

from examples.

gsanjeev432 avatar gsanjeev432 commented on June 9, 2024 6

@FelCer Actually, there is no value to satisfy the variable "stage" and "region".
So you need to either pass it from command line as serverless deploy --stage dev --region us-east-1 or else define the variables in serverless.yml.

from examples.

FelCer avatar FelCer commented on June 9, 2024

Hello @pgrzesik, That's fine if it worked, but I think this template still contains errors, like:
executing the serverless offline start command produces the following error.
image

This error is treated here, 99x/serverless-dynamodb-local#194 but without any solution.
By implementing that with the flag indicated here 99x/serverless-dynamodb-local#194 (comment) it runs correctly, but until the endpoint is consulted it generates an error.
image
image

from examples.

pgrzesik avatar pgrzesik commented on June 9, 2024

Hey @FelCer - it's very likely that this example might have additional errors, since it hasn't been actively maintained for a long time - unfortunatelly I don't know much about this specific example so I won't be able to help more there

from examples.

FelCer avatar FelCer commented on June 9, 2024

oh no, okey.
Thanks anyway I'll wait for someone else who can help me

from examples.

eriklive avatar eriklive commented on June 9, 2024

Yeah, maybe I'm a little too late, but appears to me that in "Provider" section should be a "region" element, dont?

from examples.

eriklive avatar eriklive commented on June 9, 2024

Yeah, maybe I'm a little too late, but appears to me that in "Provider" section should be a "region" element, dont?

That's right, I was facing the same issue. Here is an example that servers both ways:

image

The key is ${self:custom.integrarProdutoMLFunctionSQS.${opt:stage}} on lines 12 and 16.

The self:custom.integrarProdutoMLFunctionSQS will refeer to custom section, integrarProdutoMLFunctionSQS subsection.

But I need thoose variables being environment dependant, so I run my serverless by serverless offline start --stage local. To access my "stage" variable, set throught console, I need to use ${opt:stage}.

In conclusion:

  1. To use file values, use ${self:section.value} (like me, using self:custom.integrarProdutoMLFunctionSQS)
  2. To use varibles set throught console, use ${opt:stage}

So when I do use ${self:custom.integrarProdutoMLFunctionSQS.${opt:stage}}, running with serverless offline start --stage local, the final result will be ${self:custom.integrarProdutoMLFunctionSQS.local}, wich is what I need.

from examples.

ChuhengH avatar ChuhengH commented on June 9, 2024

is the ${self:someProperty} used in the rate(Value Unit), such as rate(${self:someProperty})?
I found it doesn't work.
But rate(${env:SOME_VAR}) will work. Why?

from examples.

Related Issues (20)

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.