Hey fellas,
I have a base code with some legacy apis, and I’m trying to unify all in one container repository (with git subrepo) and creating one unique serverless.yml file in this container.
I’m trying to do the following in my serverless file:
functions:
${file(api-1/functions.yml)}
${file(api-2/functions.yml)}
Inside this functions.yml is simply the function declaration like so:
users:
DependsOn: RedisInstance
handler: api-1/handler.index
timeout: 30
vpc:
securityGroupIds:
- Ref: RedisSecurityGroup
subnetIds:
- Ref: PrivateSubnet
events:
- http: any {proxy+}
environment:
stage: ${opt:stage}
I’m getting the error below when I try to do that:
Serverless Error ---------------------------------------
Trying to populate non string value into a string for variable ${file(api-front/functions.yml)}. Please make sure the value of the property is a string.
But when I remove one of the file its working as expected:
functions:
${file(api-1/functions.yml)}
Is there a way to concatenate multiple .yml files?
Thanks!
rowanu
September 6, 2017, 6:58am
2
Hmm, sounds like you’ve uncovered an edge-case in the variable rendering - it just doesn’t make sense that removing one line would “fix” the problem.
I think a GH issue is your best bet.
Thanks! I’m opening an issue there!
walery
March 15, 2018, 9:50am
4
For people that would like to follow status:
opened 02:10PM - 06 Sep 17 UTC
closed 01:46PM - 29 Nov 18 UTC
question
help wanted
Hey fellas,
I have a base code with some legacy apis, and I’m trying to unify… all in one container repository (with git subrepo) and creating one unique serverless.yml file in this container git.
I’m trying to do the following in my serverless file:
```
functions:
${file(api-1/functions.yml)}
${file(api-2/functions.yml)}
```
Inside this functions.yml is simply the function declaration like so:
```
users:
DependsOn: RedisInstance
handler: api-1/handler.index
timeout: 30
vpc:
securityGroupIds:
- Ref: RedisSecurityGroup
subnetIds:
- Ref: PrivateSubnet
events:
- http: any {proxy+}
environment:
stage: ${opt:stage}
```
And I'm getting the error below when I try to do that:
> Serverless Error ---------------------------------------
>
> Trying to populate non string value into a string for variable ${file(api-2/functions.yml)}. Please make sure the value of the property is a string.
But when I remove one of the file its working as expected, uploading the functions of this file:
```
functions:
${file(api-1/functions.yml)}
```
Thanks!