[SOLVED] AWS Lambda function fails (Invalid address provided)

I followed the instructions in “Lambda NodeJS Express API” in the Moralis document Web3DataAPI-Integrations-AWS Lambda, but in the local test (serverless offline start), I used Postman to test the API I tested the API using Postman on a local test (serverless offline start) and got http://localhost:3000では “Hello from root!”, but the endpoint getNativeBalance(http://localhost:3000/getNativeBalance?address=*& chain=0x1) shows
“[C0005] Invalid address provided”.
The same is true for endpoint getWalletNfts.
VSCode is the same as the code in Github (https://github.com/MoralisWeb3/examples-aws-lambda-nodejs/tree/main/aws-node-express-api-project) to your API Key. I just changed it to my API Key and created it.
The log at that time is as follows.

ANY /getNativeBalance (λ: api)
MoralisError [Moralis SDK Core Error]: [C0005] Invalid address provided
at EvmAddress.parse (E:\AWS_Server\aws-node-express-api-project\node_modules@moralisweb3\common-evm-utils\lib\dataTypes\EvmAddress\EvmAddress.js:50:19)
at new EvmAddress (E:\AWS_Server\aws-node-express-api-project\node_modules@moralisweb3\common-evm-utils\lib\dataTypes\EvmAddress\EvmAddress.js:18:34)
at EvmAddress.create (E:\AWS_Server\aws-node-express-api-project\node_modules@moralisweb3\common-evm-utils\lib\dataTypes\EvmAddress\EvmAddress.js:46:16)
at Object.getRequestUrlParams (E:\AWS_Server\aws-node-express-api-project\node_modules@moralisweb3\common-evm-utils\lib\operations\balance\getNativeBalanceOperation.js:26:41)
at OperationRequestBuilder.prepareUrl (E:\AWS_Server\aws-node-express-api-project\node_modules@moralisweb3\api-utils\lib\resolvers2\OperationRequestBuilder.js:15:40)
at OperationResolver. (E:\AWS_Server\aws-node-express-api-project\node_modules@moralisweb3\api-utils\lib\resolvers2\OperationResolver.js:58:50)
at step (E:\AWS_Server\aws-node-express-api-project\node_modules@moralisweb3\api-utils\lib\resolvers2\OperationResolver.js:33:23)
at Object.next (E:\AWS_Server\aws-node-express-api-project\node_modules@moralisweb3\api-utils\lib\resolvers2\OperationResolver.js:14:53)
at E:\AWS_Server\aws-node-express-api-project\node_modules@moralisweb3\api-utils\lib\resolvers2\OperationResolver.js:8:71
at new Promise () {
isMoralisError: true,
code: ‘C0005’,
details: undefined,
[cause]: undefined
}

Hey @Eitoku,

I’ve just checked back the tutorial and looks like the params are body params instead of path params based on the code, you should instead have address and chain in the body.

If you try to call it that way as a path, then likely in the server address will have null value :raised_hands:

Hi, YosephKS.
I changed body to query and it works!
Thank you.

1 Like

Perfect :star_struck: Glad that it helped! @Eitoku

If you have any other issues, feel free to open a new thread.

You’re welcome to come back and ask us anything, we’re available 24/7 around the clock to help you out~

Cheers