serverless-express icon indicating copy to clipboard operation
serverless-express copied to clipboard

Unable to determine event source based for running an async lambda function

Open vincevannoort-egalit opened this issue 4 years ago • 5 comments

Dear Reader,

I have gotten the following error when trying to configure a function to run async, running it sync does work.

Any ideas why this is happening?

{
    "errorType": "Error",
    "errorMessage": "Unable to determine event source based on event.",
    "stack": [
        "Error: Unable to determine event source based on event.",
        "    at getEventSourceNameBasedOnEvent (/var/task/node_modules/@vendia/serverless-express/src/event-sources/utils.js:79:9)",
        "    at proxy (/var/task/node_modules/@vendia/serverless-express/src/configure.js:37:51)",
        "    at Runtime.handler (/var/task/node_modules/@vendia/serverless-express/src/configure.js:95:12)",
        "    at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"
    ]
}

vincevannoort-egalit avatar May 02 '21 17:05 vincevannoort-egalit

As in you're doing an async invoke within your code? What does the event body look like?

brett-vendia avatar May 11 '21 19:05 brett-vendia

Do you have example code?

brettstack avatar May 31 '21 06:05 brettstack

Hi Vince,

I just ran into the same issue and for our case, in which we invoke our Lambdas through API Gateway, enabling the "Use Lambda Proxy integration" option in the integration request of the method did the job for me.

Hope it helps.

aliamrani avatar Sep 01 '21 14:09 aliamrani

I have the same problem here, any else solution for this case?

eHattori avatar Oct 20 '22 21:10 eHattori

I tried the solution offered here and it worked for me. Does not seem like the correct way to do it, though.

JeffML avatar Nov 02 '22 21:11 JeffML