Here there, I was trying to run a batch job fetching some blockchain data using Moralis APIs. The job calls Moralis API by calling (node.js)
Moralis.start({
serverUrl,
appId,
});
first. Iāve logged serverUrl and appId and double-checked that there are correct. Everything works fine when running locally or within a docker container pushed by myself on AWS ECR.
However, when trying to run the exact same script in AWS Batch using the same docker image, I got the following error in AWS logs:
(node:1) UnhandledPromiseRejectionWarning: Error: Received an error with invalid JSON from Parse: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /serve/functions/getPluginSpecs</pre>
</body>
</html>
at handleError (/app/node_modules/moralis/lib/node/RESTController.js:426:17)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Function.initPlugins (/app/node_modules/moralis/lib/node/MoralisWeb3.js:436:40)
at async Function.start (/app/node_modules/moralis/lib/node/Parse.js:146:7)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:1) UnhandledPromiseRejectionWarning: Error: Received an error with invalid JSON from Parse: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /serve/functions/getPluginSpecs</pre>
</body>
</html>
at handleError (/app/node_modules/moralis/lib/node/RESTController.js:426:17)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Function.initPlugins (/app/node_modules/moralis/lib/node/MoralisWeb3.js:436:40)
at async Function.start (/app/node_modules/moralis/lib/node/Parse.js:146:7)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
(node:1) UnhandledPromiseRejectionWarning: Error: Request failed with status code 404
at createError (/app/node_modules/axios/lib/core/createError.js:16:15)
at settle (/app/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/app/node_modules/axios/lib/adapters/http.js:293:11)
at IncomingMessage.emit (events.js:412:35)
at IncomingMessage.emit (domain.js:475:12)
at endReadableNT (internal/streams/readable.js:1334:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)
I am not sure what might be the reason for these errors. It would be great if I can get any help on this. Thanks!