dherault / dherault/serverless-offline
Issue with debugging serverless offline where it breakpoints in random bit of code in IntelliJ IDEA
- Dominant language
- JavaScript
- Stars
- 5.3k
- Forks
- 811
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 3
Description
## Bug Report
I am attempting to a Node-based Serverless application offline in my local development environment. We recently got debugging working by upgrading `serverless-plugin-typescript` to 2.1 but we're still seeing an issue which I'm assuming is with the offline plugin but I'm honestly not sure if this belongs here or in another repo's issue tracker.
**Current Behavior**
When I set a breakpoint in my code and run something to hit that point, I often see the application stop on breakpoint entirely unrelated to my breakpoint.
**Sample Code**
- file: serverless.yml
```yaml
service: my-service
plugins:
- serverless-plugin-typescript
- serverless-domain-manager
- serverless-offline-sqs
- serverless-offline
- serverless-offline-watcher
- serverless-offline-sns
- serverless-provisioned-concurrency-autoscaling
provider:
name: aws
runtime: nodejs16.x
stage: ${opt:stage, 'dev'} # 'prod' or 'dev' or 'staging'
profile: ${self:custom.profile.${self:provider.stage}}
functions:
formRender:
handler: "handlers/FormsHandler.render"
name: ${self:provider.stage}${self:provider.environment.LAMBDA_SUFFIX}-formRender
events:
- http:
cors: ${self:custom.cors}
path: forms/{formId}/visitors/{visitorTrackingId}/render
method: GET
request:
parameters:
paths:
formId: true
visitorTrackingId: true
provisionedConcurrency: ${self:custom.provisionedConcurrency.formRender.${self:provider.stage}}
concurrencyAutoscaling: ${self:custom.concurrencyAutoscaling.formRender.${self:provider.stage}}
```
- file: handler.js
```js
...
class Render extends BaseHandler {
public async processRequest(request: LambdaHandler.Request, response: LambdaHandler.Response): Promise {
console.log("Processing request started!!"); // breakpoint here
```
**Expected behavior/code**
**Environment**
```
"serverless": "3.24.1",
"serverless-domain-manager": "^5.1.0",
"serverless-jest-plugin": "^0.4.0",
"serverless-offline": "11.3.0",
"serverless-offline-sns": "^0.76.0",
"serverless-offline-sqs": "^7.3.1",
"serverless-offline-watcher": "^1.1.0",
"serverless-plugin-typescript": "2.1.5",
"serverless-provisioned-concurrency-autoscaling": "^1.9.1",
```
- `OS`: macOS 13.4
- `IDE`: Intellij IDEA
**Possible Solution**
**Additional context/Screenshots**
Example of weird breakpoint:

Notice that I don't have any other breakpoints other than my own set:

EVentually after hitting resume one time or sometimes refreshing my page a few times, I'll get to my own breakpoint:

Contributor guide
Assessment
This issue has not been assessed yet.