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

v2.1 exported CORS correctly, v3.1 no longer works #15

Closed
brainframe-me opened this issue Feb 16, 2016 · 2 comments
Closed

v2.1 exported CORS correctly, v3.1 no longer works #15

brainframe-me opened this issue Feb 16, 2016 · 2 comments

Comments

@brainframe-me
Copy link

Hi,

Is there something significant that changed? I was using serverless v0.4.2 together with serverless-cors-plugin v0.2.1 and then a "serverless endpoint deploy --all" worked perfectly to include the preflight checks etc.. when run in the root of the project.
Now when using v0.4.2 with v0.3.1, the same command suddenly crashes with following error:

C:\DATA\serverless-4kgaw\nodejscomponent\resource\show>serverless endpoint deploy --all
C:\Users\myusername\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\main\async.js:43
fn = function () { throw arg; };
^

ServerlessError: Missing required config.component, config.module, config.function, config.endpointMethod, config.endpointPath
at new ServerlessError (C:\Users\myusername\AppData\Roaming\npm\node_modules\serverless\lib\ServerlessError.js:17:11)
at new ServerlessEndpoint (C:\Users\myusername\AppData\Roaming\npm\node_modules\serverless\lib\ServerlessEndpoint.js:24:122)
at C:\DATA\serverless-4kgaw\node_modules\serverless-cors-plugin\src\index.js:98:29
at arrayEach (C:\DATA\serverless-4kgaw\node_modules\serverless-cors-plugin\node_modules\lodash\lodash.js:482:11)
at Function.forEach (C:\DATA\serverless-4kgaw\node_modules\serverless-cors-plugin\node_modules\lodash\lodash.js:7720:11)
at ServerlessCors.addPreflightRequests (C:\DATA\serverless-4kgaw\node_modules\serverless-cors-plugin\src\index.js:78:9)
From previous event:
at C:\Users\myusername\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:157:29
at Array.reduce (native)
at C:\Users\myusername\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:156:30
at processImmediate as _immediateCallback
From previous event:
at Serverless._execute (C:\Users\myusername\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:154:10)
at Serverless.actions.(anonymous function) (C:\Users\myusername\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:382:20)
at Serverless.command (C:\Users\myusername\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:351:38)
at Object. (C:\Users\myusername\AppData\Roaming\npm\node_modules\serverless\bin\serverless:16:12)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3

I've got following code in s-module.json:
{
"name": "auth",
"profile": "aws-v0.3.1",
"custom": {
"cors": {
"allowOrigin": "*",
"allowHeaders": [
"Content-Type",
"X-Amz-Date",
"Authorization",
"X-Api-Key",
"x-amz-security-token",
"Access-Control-Allow-Origin"
]
}
},
"cloudFormation": {
"resources": {},
"lambdaIamPolicyDocumentStatements": []
}
}

Any ideas?

@joostfarla
Copy link
Owner

In Serverless v0.4 the module concept was dropped, but it has been kept backwards compatible. This change has been reflected in the plugin in v0.3, but without backwards compatibility.

So, probably the best way to solve this is by getting rid of your s-module.json files. Furthermore, the plugin now supports component-level policies. Does this help you?

@joostfarla
Copy link
Owner

Great, that was the problem.
Thanks!

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

No branches or pull requests

2 participants