-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
cannot load config from separate file #2169 s #2773
Comments
Hmm. This should work according to https://serverless.com/framework/docs/providers/aws/guide/variables#reference-variables-in-other-files Is your filename correct? In the description it says that the name is |
@greendavegreen any updates on this one? Have you tried the suggestion above? We've merged some changes recently. You might also want to check against the current |
I'm running 1.4 on a windows 10 box and I cannot get this to work either.
env.yml is located in the root of the project, alongside serverless.yml. It's contents are as follows:
Edit: I've just realized mine failed because I'm trying to load something other than a string into an environment variable. Environment variables must be string values and objects are not accepted. Maybe add a warning about this to the user? |
@camhart I just discovered this too! Objects aren't allowed... I'd like for when processing environment-variables, that if the property is an object to stringify it before adding it to the CF template. That way we can still add in objects (that may be dynamic in size/property names) to environment variables. Inside the app code we could handle the stringified object. |
We are facing the same issue. Trying to import a JSON file. Our file looks roughly like this:
And we get the error:
The json file is literally just |
Have you tried this:
|
You have to include the colon and object reference within the file being included. For example in YAML, but the same will apply in JSON: # serverless.yml
functions:
testAuth: ${file(routes.yml):testAuth}
postArticles: ${file(routes.yml):postArticles} # routes.yml
testAuth:
handler: routes/test.handler
postArticles:
handler: routes/postArticles.handler We use this all throughout the |
This should've been fixed in the meantime. Feel free to reopen if this is still an issue. |
Hi! It appears that when I try to reference a file that is higher up in the directory, it's not able to reference it. Is that intended? |
I just installed 1.2 and was going to try using environment variables AND moving sensitive items into a separate file that I can .gitignore.
I created a config.yml file to store the items subject to change. and then tried loading them into my serverless.yml.
contents of config.yml:
and the opening of my serverless.yml
results in the error message:
If I change the troubled Resource statement to use self.custom.dropBucket instead of self.cfg.dropBucket, my deploy works fine. I would like to get the custom items out of this file and safely into separate file of info likely to change from deploy to deploy.
Similar or dependent issues:
The text was updated successfully, but these errors were encountered: