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

serverless-webpack & serverless-offline support? #66

Closed
bcrigler opened this issue Apr 4, 2022 · 5 comments · Fixed by #70
Closed

serverless-webpack & serverless-offline support? #66

bcrigler opened this issue Apr 4, 2022 · 5 comments · Fixed by #70
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@bcrigler
Copy link

bcrigler commented Apr 4, 2022

So, I see you support serverless-offline, although I can't seem to get my documentation to load at the route /swagger. It gives me a 404, and the only thing I can think of is it's because I'm using serverless-webpack.

My Config:

custom:
  autoswagger:
    generateSwaggerOnDeploy: true
    typefiles: ['./src/models/response/body.response.d.ts']
    apiKeyHeaders: ['Authorization']
    swaggerPath: "documentation"
    useStage: false

My Plugins: (I also tried with serverless-auto-swagger above serverless-webpack)

plugins:
  - serverless-webpack
  - serverless-auto-swagger
  - serverless-offline
  - serverless-deployment-bucket

NPM Module Versions: (from package.json)

"serverless": "^2.72.3",
"serverless-auto-swagger": "^2.4.1",
"serverless-deployment-bucket": "^1.5.2",
"serverless-offline": "8.5.0",
"serverless-webpack": "5.6.1",
@bcrigler
Copy link
Author

bcrigler commented Apr 4, 2022

So, I figured this out... as a note for you, if you wanted to update your docs, this is how I got it working:

Plugin Order: (must come first before webpack)

plugins:
  - serverless-auto-swagger
  - serverless-webpack
  - serverless-offline
  - serverless-deployment-bucket

I also had to use this command when starting serverless-offline, which puts serverless-offline into backwards compatibility mode:

serverless offline start

@bcrigler bcrigler closed this as completed Apr 4, 2022
@bfaulk96
Copy link
Collaborator

bfaulk96 commented Apr 5, 2022

@bcrigler That's a good point with the docs.
It does indeed need to come before serverless-webpack, serverless-plugin-typescript, etc., I didn't realize that wasn't mentioned

@bfaulk96
Copy link
Collaborator

bfaulk96 commented Apr 5, 2022

Reopening to track that we are lacking this documentation. Thanks!

@bfaulk96 bfaulk96 reopened this Apr 5, 2022
@bfaulk96 bfaulk96 added documentation Improvements or additions to documentation good first issue Good for newcomers labels Apr 5, 2022
@bcrigler
Copy link
Author

bcrigler commented Apr 6, 2022

Also, beyond the order of the plugins it's notable that on Serverless 2.x I had to use backwards compatibility mode via this command: serverless offline start versus the current command serverless offline. Serverless 3.x, I was unable to get this working but I didn't try backwards compatibility mode. If you guys are able to use 2.x/3.x without backwards compatibility mode, it might be a non-issue although I had my API working with an upgrade from 1.x -> 3.x but this plugin I couldn't get working so I downgraded to 2.x with the same result, although that's when I discovered backwards compatibility mode, and it might signify that something in your project is legacy Serverless and needs deprecated methods from Serverless changed to their current counterparts.

@bfaulk96
Copy link
Collaborator

This plugin should work find with Serverless 3, but I'll look into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants