Closed Alua-Kinzhebayeva closed 8 years ago
That's correct, the template is not compiled when the hook is fired so endpoint.responses
here is the $${whatever}
string and thus the error.
No idea how to fix this :/
Hmm not sure if this can be fixed without changing the order of how the framework handles the templating. @ac360, any thought on how we can fix this?
@joostfarla It looks like you can, as mentioned in https://github.com/serverless/serverless/issues/561
@openback thanks for the info! I have a working solution and will probably release it in a few days!
Also waiting for the new release
Today it will be released :)
Templating support has just been released in v0.3.2. Thanx all!
Please let me know if you experience any problems.
I am running the latest versions of sls and CORS plugin. I have placed my response mappings into s_templates.json, and reference them in s_function as
"responses": "$${defaultResponses}"
. So when I try to use CORS on an endpoint with such mapping, the plugin throws an errorserverless:lib.node_modules.serverless.lib.actions.EndpointDeploy TypeError: Cannot assign to read only property 'responseParameters' of $ at /Users/abc/Apps/my_project/node_modules/serverless-cors-plugin/src/index.js:51:39
It is probably due to the fact sls doesn't replace $$ variable with its corespondent value at this stage. And if I replace $$ variable with proper mappings, it works, only OPTIONS method is missing.