juanjoDiaz/serverless-middleware

probably a configuration mistake: TypeError: handler.substr is not a function

Closed this issue · 1 comments

we're on Serverless 2.5 and trying to configure the middleware plugin.
here is the test configuration

test-middleware:
    handler: 
      - api/helpers/version-manager-2.checkVersion
      - api/http/discover/testmw.handler
    description: GET test-middleware
    events:
      - http:
          path: test-middleware
          method: get

but when we're starting sls offline we get this error:

TypeError: handler.substr is not a function
      at splitHandlerPathAndName (/code/pr_2/node_modules/serverless-offline/dist/utils/splitHandlerPathAndName.js:13:24)
      at HttpServer.createRoutes (/code/pr_2/node_modules/serverless-offline/dist/events/http/HttpServer.js:371:63)
      at Http._create (//code/pr_2/node_modules/serverless-offline/dist/events/http/Http.js:43:65)
      at /code/pr_2/node_modules/serverless-offline/dist/events/http/Http.js:52:12
      at Array.forEach (<anonymous>)
      at Http.create (/code/pr_2/node_modules/serverless-offline/dist/events/http/Http.js:47:12)
      at ServerlessOffline._createHttp (/code/pr_2/node_modules/serverless-offline/dist/ServerlessOffline.js:230:53)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
      at async Promise.all (index 0)
      at ServerlessOffline.start (/code/pr_2/node_modules/serverless-offline/dist/ServerlessOffline.js:145:5)
      at ServerlessOffline._startWithExplicitEnd (/code/pr_2/node_modules/serverless-offline/dist/ServerlessOffline.js:194:5)

actually never mind - it looks like it's an issue with Serverless Offline plugin, not with the Middleware.

it would be great to have sls offline work as well though, I may try to create an improvement request there...