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
schema validations for environment variables fail #8285
Comments
@dazza-codes I'm not able to reproduce that error, also Can you provide full content of |
Running
will yield a warning like:
Installed version:
|
I had the same issue after upgrading serverless from 1 to 2. What worked for me was to use a string value instead of integer. |
I have the exact same problem. I use functions in my environment vars to grab things like a cloudfront distribution address, and reference that var in code for things like CORS responses. Imagine the following: service: temp-aws-nodejs-hello
frameworkVersion: '2'
provider:
name: aws
runtime: nodejs12.x
functions:
hello:
handler: handler.hello
environment:
TEST_VAR:
'Fn::Join':
- ''
- - 'foo'
- 'bar' do a $ serverless deploy
Serverless Error ---------------------------------------
Configuration error at 'functions.hello.environment.TEST_VAR': unsupported configuration format
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 14.12.0
Framework Version: 2.3.0 (local)
Plugin Version: 4.0.4
SDK Version: 2.3.2
Components Version: 3.2.0 This issue does not occur in v2.1.1 (The version my project was on previously) |
@sorenandersen in your case problem is that Simply write it as |
@thtliife Currently we do not support resolution of Anyway we will happily accept a PR that brings that support (we already support resolution of serverless/lib/plugins/aws/invokeLocal/index.js Lines 188 to 192 in 7f47448
|
Thanks for the clarification @medikoo. For now i will stick to version 2.1.1, as both those CF Functions work fine there. |
I am also getting this issue since upgrading: custom:
WSS_API_ENDPOINT:
!Join [
"",
[
"https://",
!Ref WebsocketsApi,
".execute-api.",
"${self:provider.region}",
".amazonaws.com/",
"${self:provider.stage}/",
],
]
functions:
WebsocketHandler:
environment:
WSS_API_ENDPOINT: "${self:custom.WSS_API_ENDPOINT}" This works totally fine, and i am not (and have no intention of) locally invoking the lambda. But i am still getting |
@thtliife Note, that in 2.3.0 all works same, the only difference is that config validation warning is issued |
@stevenj we're open to accept an option like PR that introduces that is welcome |
@medikoo Thankyou very much. |
Hi @medikoo
I stumbled on this with a custom:
someUrl: !Sub 'https://${self:custom.someDomain}' Looking at the reference you gave and by debugging it, I noticed that the value of if (value['Fn::ImportValue']) {
configuredEnvVars[name] = await resolveCfImportValue(
this.provider,
value['Fn::ImportValue']
);
} else if (value.Ref) {
configuredEnvVars[name] = await resolveCfRefValue(this.provider, value.Ref);
} else if (value['Fn::Sub']) {
configuredEnvVars[name] = value['Fn::Sub'];
} else { Now, before pushing a new PR for this, I'm wondering if in the case of Thanks in advance |
@tonivdv this issue was actually addressed, I just forgot to close it (closing it now) Now answering your question, why you're using custom:
someUrl: https://${self:custom.someDomain} |
That's a very good question. 🙈 Thanks |
For serverless 2.x, the schema validation fails for environment variables
With
serverless.yaml
that contains environment variables, e.g.The errors are like:
serverless.yml
sls package
outputInstalled version
The text was updated successfully, but these errors were encountered: