joostfarla / serverless-cors-plugin

Serverless CORS Plugin - Managing Cross-origin resource sharing (CORS) policies
ISC License
70 stars 15 forks source link

sls dash deploy --all fails due to missing sPath #12

Closed Alua-Kinzhebayeva closed 8 years ago

Alua-Kinzhebayeva commented 8 years ago

When I run new version of sls and cors plugin, I get the following error

ALUAs-MBP:users g_alua$ sls endpoint deploy --all
/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:48
        fn = function () { throw arg; };
                           ^

ServerlessError: Missing required config.sPath
    at new ServerlessError (/usr/local/lib/node_modules/serverless/lib/ServerlessError.js:17:11)
    at new ServerlessEndpoint (/usr/local/lib/node_modules/serverless/lib/ServerlessEndpoint.js:24:142)
    at /Users/g_alua/App/monei/node_modules/serverless-cors-plugin/src/index.js:98:29
    at arrayEach (/Users/g_alua/App/monei/node_modules/lodash/lodash.js:474:11)
    at Function.forEach (/Users/g_alua/App/monei/node_modules/lodash/lodash.js:7633:11)
    at ServerlessCors.addPreflightRequests (/Users/g_alua/App/monei/node_modules/serverless-cors-plugin/src/index.js:78:9)
From previous event:
    at /usr/local/lib/node_modules/serverless/lib/Serverless.js:156:29
    at Array.reduce (native)
    at /usr/local/lib/node_modules/serverless/lib/Serverless.js:155:30
    at processImmediate [as _immediateCallback] (timers.js:383:17)
From previous event:
    at Serverless._execute (/usr/local/lib/node_modules/serverless/lib/Serverless.js:153:10)

I checked sls source code and seems that now in Endpoint class they validate sPath. ((!config.component || !config.module || !config.function || !config.endpointPath || !config.endpointMethod) && !config.sPath)

joostfarla commented 8 years ago

Working on it! Just noticed this while preparing the next major release. Will be fixed asap.

Alua-Kinzhebayeva commented 8 years ago

thanks! :smile:

joostfarla commented 8 years ago

Fixed in v0.3.0!