|
1 | | -/* |
2 | | - * Copyright (c) 2024 DevRev Inc. All rights reserved. |
3 | | -
|
4 | | -Disclaimer: |
5 | | -The code provided herein is intended solely for testing purposes. |
6 | | -Under no circumstances should it be utilized in a production environment. Use of |
7 | | -this code in live systems, production environments, or any situation where |
8 | | -reliability and stability are critical is strongly discouraged. The code is |
9 | | -provided as-is, without any warranties or guarantees of any kind, and the user |
10 | | -assumes all risks associated with its use. It is the responsibility of the user |
11 | | -to ensure that proper testing and validation procedures are carried out before |
12 | | -deploying any code into production environments. |
13 | | -*/ |
14 | | - |
15 | 1 | import bodyParser from 'body-parser'; |
16 | 2 | import express, { Express, Handler, Request, Response } from 'express'; |
17 | 3 |
|
@@ -111,6 +97,16 @@ async function handleEvent(events: any[], isAsync: boolean, resp: Response) { |
111 | 97 |
|
112 | 98 | for (let event of events) { |
113 | 99 | let result; |
| 100 | + if (!event.execution_metadata) { |
| 101 | + let errMsg = 'Invalid request format: missing execution_metadata'; |
| 102 | + error = { |
| 103 | + err_type: RuntimeErrorType.InvalidRequest, |
| 104 | + err_msg: errMsg, |
| 105 | + } as RuntimeError; |
| 106 | + console.error(error.err_msg); |
| 107 | + resp.status(400).send(errMsg); |
| 108 | + return; |
| 109 | + } |
114 | 110 | const functionName: FunctionFactoryType = event.execution_metadata.function_name as FunctionFactoryType; |
115 | 111 | if (functionName === undefined) { |
116 | 112 | error = { |
|
0 commit comments