- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 802
 
Open
Description
Bug Report
Current Behavior
When running sls offline for a Serverless application using serverless-offline with the configuration below, an error occurs: TypeError: ee.on is not a function. This seems to prevent the expected startup of the local server.
Sample Code
- file: serverless.yml
 
service: sls-test
provider:
  name: aws
  runtime: nodejs20.x
functions:
  api:
    handler: dist/lambda.handler
    events:
      - http:
          path: /
          method: ANY
      - http:
          path: '{proxy+}'
          method: ANY
package:
  exclude:
    - node_modules/**
plugins:
  - serverless-offline- file: handler.js
 
import serverlessExpress from '@codegenie/serverless-express';
import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";
import { Callback, Context, Handler } from 'aws-lambda';
let server : Handler;
export const handler = async (event: any, context: Context, callback: Callback) => {
    if(!server) {
        const app = await NestFactory.create(AppModule);
        await app.init();
        const expressApp = app.getHttpAdapter().getInstance();
        server = serverlessExpress({
            app: expressApp
        });
    }
    return server(event, context, callback);
}Expected behavior/code
The application should start without errors and expose the API endpoints locally using serverless-offline.
Environment
serverlessversion: 4.4.7serverless-offlineversion: 14.3.3node.jsversion: v20.18.0OS: macOS 15.0.1
optional, if you are using any of the following frameworks to invoke handlers
nestJSversion: 10.4.5
Possible Solution
It could be helpful to check for compatibility issues with serverless-offline or dependencies like ee-first in conjunction with the current node.js version.
Additional context/Screenshots
Output when running sls offline:
[Error Logs...]
✖ TypeError: ee.on is not a function
...
AlexFromXD, skehlet, ingalls, RafaelMoro and TheBlueFriend
Metadata
Metadata
Assignees
Labels
No labels