Open jeff-pal opened 2 years ago
I am also getting this with a basic Express app (v4.17.1) + "@vendia/serverless-express": "^4.5.2",
server.js
const express = require('express');
const app = express();
// app setup
module.exports = app;
handler.js
const serverlessExpress = require('@vendia/serverless-express')
const server = require('./server');
module.exports = serverlessExpress({ server });
at getFramework (/my-app/node_modules/@vendia/serverless-express/src/frameworks/index.js:7:18)
at configure (/my-app/node_modules/@vendia/serverless-express/src/configure.js:22:35)
at Object.<anonymous> (/my-app/src/handler.js:7:18)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/my-app/test/integration/handler.test.js:4:17)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at ModuleWrap.<anonymous> (internal/modules/esm/translators.js:199:29)
at ModuleJob.run (internal/modules/esm/module_job.js:183:25)
at async Loader.import (internal/modules/esm/loader.js:178:24)
at async formattedImport (/my-app/node_modules/mocha/lib/nodejs/esm-utils.js:7:14)
at async Object.exports.requireOrImport (/my-app/node_modules/mocha/lib/nodejs/esm-utils.js:48:32)
at async Object.exports.loadFilesAsync (/my-app/node_modules/mocha/lib/nodejs/esm-utils.js:88:20)
at async singleRun (/my-app/node_modules/mocha/lib/cli/run-helpers.js:125:3)
at async Object.exports.handler (/my-app/node_modules/mocha/lib/cli/run.js:374:5)```
see the same issue "@vendia/serverless-express": "~4.8.0" + "express": "4.17.3", index.js
const { app } = require('./server/app');
const serverlessExpress = require('@vendia/serverless-express');
/**
* Main entry point for the application
*/
exports.handler = serverlessExpress({ app} );
was lambda error
{ "errorType": "TypeError", "errorMessage": "Cannot read property 'callback' of undefined", "stack": [ "TypeError: Cannot read property 'callback' of undefined", " at getFramework (/var/task/node_modules/@vendia/serverless-express/src/frameworks/index.js:7:18)", " at configure (/var/task/node_modules/@vendia/serverless-express/src/configure.js:22:35)", " at Object.<anonymous> (/var/task/index.js:10:21)", " at Module._compile (internal/modules/cjs/loader.js:1085:14)", " at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)", " at Module.load (internal/modules/cjs/loader.js:950:32)", " at Function.Module._load (internal/modules/cjs/loader.js:790:12)", " at Module.require (internal/modules/cjs/loader.js:974:19)", " at require (internal/modules/cjs/helpers.js:101:18)", " at _tryRequireFile (/var/runtime/UserFunction.js:63:32)" ] }
same error in here
const serverlessExpress = require('@vendia/serverless-express');
const app = require('./serverless/main').server;
exports.handler = serverlessExpress({ app })
version:
"@vendia/serverless-express": "4.8.0"
Change the handler.js to the following.
exports.handler = serverlessExpress({ app: app })
What is wrong about the code above? I'm getting the following error: