juanjoDiaz / serverless-middleware

Serverless plugin to allow middleware handlers configured directly in serverless.yaml
MIT License
18 stars 11 forks source link

serverless-typescript or serverless-esbuild #41

Closed DnSu closed 2 years ago

DnSu commented 2 years ago

Does this plugin work along with serverless-typescript or serverless-esbuild? It doesn't seem like the auth and log is being called at all for me

plugins:
  - serverless-esbuild
  - serverless-middleware
 hello:
    handler: src/Hello/hello.hello
    events:
      - http:
          path: hello
          method: get
          cors: true
    middleware:
      pre:
        - src/Middleware/auth.auth
      pos:
        - catch: src/Middleware/log.log
juanjoDiaz commented 2 years ago

Hi @DnSu ,

It should work. There is definitely people using it with webpack and similar plugins.

Try

plugins:
  - serverless-middleware
  - serverless-esbuild

the order matters here since you want your middlewares to be "built" before processing the handler with esbuild.

If that doesn't work, you can create a small project so I can replicate, and I can troubleshoot and tell you what's wrong 🙂

juanjoDiaz commented 2 years ago

Closing since there has been any response. Feel free to reopen if needed.