Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Serverless 1.33 does not properly support integers as external values #5534

Closed
Jaystified opened this issue Nov 29, 2018 · 8 comments · Fixed by #5562
Closed

Comments

@Jaystified
Copy link

Jaystified commented Nov 29, 2018

This is a Bug Report

Description

  • What went wrong?
    A logRetentionInDays should be an integer over 0 error interrupts deployment when the logRetentionInDays value is provided externally (in my case via a shell command)
  • What did you expect should have happened?
    Externally provided integer is properly interpreted and deployment completes successfully.
  • What was the config you used?
    Trying to deploy a 60-day expiration log retention lambda to AWS.
  • What stacktrace or error message from your provider did you see?
    logRetentionInDays should be an integer over 0
    Node version is 8.10.0

Similar or dependent issues:
This forum post
This stackoverflow post
Not mine, but assuming same issue

Additional Data

  • Serverless Framework Version you're using: 1.33.[0,1,2] (Error occurs in all three versions. 1.32 and earlier work as expected.)
  • Operating System: Linux (Xubuntu 18.04)
  • Stack Trace:
  • Provider Error messages: logRetentionInDays should be an integer over 0
@dschep
Copy link
Contributor

dschep commented Nov 29, 2018

Could you provide the relevant parts of your serverless.yml please?

@Jaystified
Copy link
Author

service: "issue"
provider:
  name: "aws"
  stage: "dev"
  logRetentionInDays: "${opt:logRetentionInDays, self:custom.defaultLogRetentionInDays}"
  runtime: "nodejs8.10"
functions:
  hello:
    handler: "handler.hello"
    events: []
plugins: []
package:
  artifact: "../../target/lambda.zip"
custom:
  defaultLogRetentionInDays: 14

@dschep
Copy link
Contributor

dschep commented Nov 30, 2018

Ah.. What if you do:

  logRetentionInDays: ${opt:logRetentionInDays, self:custom.defaultLogRetentionInDays}

(remove the quotes)

@dschep
Copy link
Contributor

dschep commented Nov 30, 2018

Tho I wouldn't expect ${opt:logRetentionInDays} to work 😞 I'm not sure how this is dealt with for other options that must be integers. IMO because of the ${opt:adsflajdf} feature (and other variable sources like SSM) it makes sense to attempt to cast values to the right type. Thoughts @pmuens @eahefnawy @horike37?

@Jaystified
Copy link
Author

Confirming that removing the quotes does not change the outcome.

Was the ${opt:adsflajdf} feature modified in 1.33?

@dschep
Copy link
Contributor

dschep commented Dec 3, 2018

does logRetentionInDays: ${self:custom.defaultLogRetentionInDays} alone with an integer at custom.defaultLogRetentionInDays work? I don't think the opt option has ever coerced values to different types :/

@Jaystified
Copy link
Author

Yes, ${self:custom.defaultLogRetentionInDays} alone does work (as does the full line when the var isn't provided).
Since the original serverless.yml did work as-is in previous versions, the variables were coerced somehow at some point :\

@dschep
Copy link
Contributor

dschep commented Dec 4, 2018

Thanks for the details @Jaystified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants