Discovered a bug in v6.7.0 that wasn't present in v6.6.0. When invoking functions, I'm seeing:

Current Behavior
When invoking functions against my service, I'm seeing the aforementioned rejection errors from the framework. When running v6.6.0 of the library, everything works as intended but v6.7.0 has this bug.
Sample Code
Here's a branch with full reproduction. Was able to get v6.6.0 working on it and once I upgraded to v6.7.0 it failed: https://github.com/dustinsgoodman/serverless-template/pull/13
Expected behavior/code
I should be able to run my lambda function twice in succession without a failure.
Environment
serverless version: v2.0.0serverless-offline version: v6.7.0node.js version: v12.18.2OS: Ubuntu 16.04Possible Solution
Looks like invocationRoute.js changed to return an async function but didn't properly fix the key-value mapping on the return object and might not be handling the await downstream. See https://github.com/dherault/serverless-offline/compare/v6.7.0...master#diff-c23f5dac27510ddbb5b7b60780e7571dR12.
Hello, maybe it's the same issue as https://github.com/dherault/serverless-offline/issues/1075.
But the actual answer is not the ideal solution. Here we rollback serverless-offline to v6.6.0
@VincentClair looks like #1075 is definitely related. However, it is closed with no real resolution. Looks like there might a breaking change in the codebase which is probably less than ideal.
I got the same error trying to promisify redis, the first request works, the second one:
offline: Failure: The "original" argument must be of type function. Received undefined
I'm having trouble with this issue too. For a while I'm using the version 6.5.0. With the newest version, every request makes start a new application. This causes trouble when using TypeORM, for example.
This issue causes trouble in type-graphql too after upgrading from 6.4.0 to 6.7.0.
I am having the same issue. This is limited to above 6.4.0. We use offline to test our code in the deployment pipeline.
We can only make one call and then it errors out
`'use strict'
const { spawn } = require('child_process')
const axios = require('axios')
const { slsOffline, updateBearerToken, updateAccountBearerToken, updateLoginInfo, loginData } = require('./config')
let slsOfflineProcess
before(async () => {
console.log('[Tests Bootstrap] Start')
// Make sure to clean up any orphan sls processes
spawn('pkill', ['-f', 'sls'])
await startSlsOffline()
console.log('Server ready')
// await Promise.delay(10000) // We must wait for sls offline to actually be ready to listen for requests
console.log('[Tests Bootstrap] Done')
})
async function startSlsOffline () {
const env = Object.create(process.env)
// env.AUTHORIZER = '{"principalId": "SAC0011743569:d701d1d0-5f94-11e9-b8d3-f53452b983ed"}'
const stage = process.env.TEST_STAGE
const path = 'pb/login/'
try {
const login = stage === 'prod' ? await prodLogin.post(path, loginData) : await devLogin.post(path, loginData)
updateBearerToken(login.data.token)
updateAccountBearerToken(login.data.accountToken)
updateLoginInfo(login.data.loginId)
// env.AUTHORIZER = '{"principalId": "' + login.data.loginId + '"}'
// console.log(env.AUTHORIZER)
// console.log(login.data.loginId)
// console.log(getBearerToken())
} catch (e) {
throw new Error(e)
}
slsOfflineProcess = spawn('sls', ['offline', 'start', '--stage', process.env.TEST_STAGE, '--httpPort', slsOffline.port, '--apiKey', slsOffline.key], { env: env })
console.log(Serverless: Offline started with PID : ${slsOfflineProcess.pid} STAGE : ${process.env.TEST_STAGE})
for await (const data of slsOfflineProcess.stdout) {
if (data.includes('offline: [HTTP] server ready:')) {
console.log(data.toString().trim())
return
} else if (data.includes('Serverless Error')) {
console.log(data.toString().trim())
throw new Error(data.toString().trim())
}
}
slsOfflineProcess.stderr.on('data', (errData) => {
console.log(Error starting Serverless Offline:\n${errData})
throw new Error(errData)
})
}
after(() => {
console.log('[Tests Teardown] Start')
stopSlsOffline()
console.log('[Tests Teardown] Done')
})
function stopSlsOffline () {
slsOfflineProcess && slsOfflineProcess.kill()
console.log(slsOfflineProcess.killed)
// The above doesn't actually kill the process on my end, even though it sends the kill signal and reports it
// Kill it with fire!
spawn('pkill', ['-f', 'sls'])
console.log('Serverless Offline stopped')
}
`
@dherault just pointed out that v6.8.0 was released today in the Gitter. I've updated https://github.com/dustinsgoodman/serverless-template/pull/13 to use v6.8.0 and this issue has been resolved using the latest. Closing since the issue is now resolved.