question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Overwriting variable resolution require string fallbacks to be fully resolvable

See original GitHub issue

Bug Report

Description

1. What did you do? In my serverless.yaml I declare a variable with this syntax: ${env:SomeUrl, "${cf:my-stack.ServiceEndpoint}/api"}. My intent is to use the cloudformation resolution (which only gives part of url) in most cases. But in some cases I want to override the URL by a sysenv variable. For example when there is no “my-stack” deployed. But if I set env variable SomeUrl and my-stack is not deployed deployed, it fails 😦

2. What happened?

ServerlessError: Stack with id my-stack does not exist

3. What should’ve happened? The resolver should succeed by just successfully resolve env:SomeUrl. Because the second part is only some kind of fallback it is of no interest if the first part is resolvable.

4. What’s the content of your serverless.yml file?

custom:
  - someurl: ${env:SomeUrl, "${cf:my-stack.ServiceEndpoint}/api"}

5. What’s the output you get when you use the SLS_DEBUG=* environment variable (e.g. SLS_DEBUG=* serverless deploy) I call SLS_DEBUG=* SomeUrl=http://localhost/foo sls package

The output is

[...]
Serverless: [AWS cloudformation 400 0.267s 0 retries] describeStacks({ StackName: 'my-stack' })

  Serverless Error ---------------------------------------

  ServerlessError: Stack with id my-stack does not exist
      at C:\Users\xyz\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\provider\awsProvider.js:329:27
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

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

  Your Environment Information ---------------------------
     Operating System:          win32
     Node Version:              12.16.1
     Framework Version:         1.65.0
     Plugin Version:            3.4.1
     SDK Version:               2.3.0
     Components Version:        2.22.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
medikoocommented, Mar 7, 2020

@sschulze I agree, ideally fallback should be resolved only when we fallback to it. It might be an issue in design of variable resolver. We’re open for PR that improves that.

I’m adding @erikerikson to the discussion, as he has very good understanding of variable resolution mechanism in the Framework, and may provide a valuable insight.

0reactions
medikoocommented, Apr 12, 2021

Closing as it’s works as proposed with new variables resolver, which was shipped recently

Read more comments on GitHub >

github_iconTop Results From Across the Web

ResolvableType (Lettuce 6.0.2.RELEASE API) - javadoc.io
Convenience method that will get and resolve generic parameters, using the specified fallback if any type cannot be resolved. ResolvableType · resolveType().
Read more >
Apollo Federation subgraph specification
The sdl field returns a string representation of the subgraph's schema. The returned sdl string has the following requirements: It must include all...
Read more >
ResolvableType (Spring Framework 6.0.3 API)
resolve. Resolve this type to a Class , returning the specified fallback if the type cannot be resolved. This method will consider bounds...
Read more >
Universal Scene Description: UsdStage Class Reference
Serialization methods for "flattening" a composition (to varying degrees), and exporting a completely flattened view of the stage to a string or file....
Read more >
Learning the Basics
When such a repository is configured, Gradle totally bypasses its dependency cache for it as ... resolve all resolvable configurations, which includes:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found