Uniswap / routing-api

GNU General Public License v3.0
144 stars 180 forks source link

Internal server error during quote api call #115

Open ahmadhuss opened 1 year ago

ahmadhuss commented 1 year ago

Hi,

There is a problem that I am trying to figure out since 1 day, the APIs are successfully deployed on AWS. But during API calls

GET - https://xxx.execute-api.us-east-1.amazonaws.com/prod/quote

Response:

{
    "message": "Internal server error"
}

It returns an internal server error in response. I followed the steps in the documentation on the custom Ubuntu server which is connected to an AWS account and it deployed successfully.

npm install && npm run build
cdk deploy RoutingAPIStack

hello

This is .env file in the directory.

THROTTLE_PER_FIVE_MINS = '' # Optional
JSON_RPC_PROVIDER_16777 = 'https://testnet-rpc.epeescan.com'
#RPC Providers must be set for the following CHAIN IDs:
MAINNET = 1
ROPSTEN = 3
RINKEBY = 4
KOVAN = 42
OPTIMISM = 10
OPTIMISTIC_KOVAN = 69
ARBITRUM_ONE = 42161
ARBITRUM_RINKEBY = 421611
POLYGON = 137
POLYGON_MUMBAI = 80001
EPE_TESTNET = 16777
TENDERLY_USER = 'xxx212' # For enabling Tenderly simulations
TENDERLY_PROJECT = 'Project' # For enabling Tenderly simulations
TENDERLY_ACCESS_KEY = 'T54-90LtMFjNwz0WpeY0oC31Lalo7atw' # For enabling Tenderly simulations

1.AWS CloudWatch Log Groups:

API-Gateway-Execution-Logs_xxx/prod

(19f10c20-1503-47d2-b4da-c7d9807ac36b) Extended Request Id: AX6lVG4LIAMFxxQ=
(19f10c20-1503-47d2-b4da-c7d9807ac36b) Lambda execution failed with status 200 due to customer function error: Cannot call allow/valid/invalid with undefined. Lambda request id: fa62a267-df63-4d96-b057-5f2ca7312251

2.AWS API Gateway Test:

Routing API

Resource /quote:

{"message": "Internal server error"}

Wed Feb 15 09:46:41 UTC 2023 : Endpoint response body before transformations: {"errorType":"Error","errorMessage":"Cannot call allow/valid/invalid with undefined","trace":["Error: Cannot call allow/valid/invalid with undefined"," 
at b0e.exports.b0e.exports (/node_modules/@hapi/hoek/lib/error.js:23:19)","  
at null.y0e.exports (/node_modules/@hapi/hoek/lib/assert.js:21:11)","    
at sa.Base._values (/node_modules/@hapi/joi/lib/base.js:992:13)","    
at sa.Base.allow (/node_modules/@hapi/joi/lib/base.js:68:21)","    
at sa.Base.valid (/node_modules/@hapi/joi/lib/base.js:286:26)","    
at Object.<anonymous> (/lib/handlers/quote-to-ratio/schema/quote-to-ratio-schema.ts:24:6)","   
at Module._compile (internal/modules/cjs/loader.js:1085:14)","    
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)","    
at Module.load (internal/modules/cjs/loader.js:950:32)","   
at Function.Module._load (internal/modules/cjs/loader.js:790:12)"]}
Wed Feb 15 09:46:41 UTC 2023 : Lambda execution failed with status 200 due to customer function error: Cannot call allow/valid/invalid with undefined. Lambda request id: ce110fa7-2c6c-4853-b4c4-0f90cf7f8ff3
Wed Feb 15 09:46:41 UTC 2023 : Method completed with status: 502

3.AWS Lamda Function Test:

RoutingAPIStack-RoutingLamb-RoutingLambda2C4DF0900-bOtplPqdwlqV | Routing Lambda

submissioner

I would really appreciate it If someone could help me with this problem.

I want to know what is the main reason for this issue.

aws-cli: aws-cli/2.9.23 Python/3.9.11 Linux/5.15.0-58-generic exe/x86_64.ubuntu.22 prompt/off

cdk: 2.64.0 (build fb67c77)

The changes on the files are according to the environment variables:

JSON_RPC_PROVIDER_16777 = 'https://testnet-rpc.epeescan.com'
EPE_TESTNET = 16777

screenshot:

commitiment

pullstacker commented 8 months ago

hi @ahmadhuss did you eventually find the solution? because i got the same problem

ahmadhuss commented 8 months ago

hi @ahmadhuss did you eventually find the solution? because i got the same problem

Hi, @pullstacker I haven't found any solution to this problem.

pullstacker commented 8 months ago

i just solved this issue last night, for me it was because wrong rpc and chainid variables in .env, perhaps you can double check everything related to those variables. also ensure your chainid included in smartorderrouter dependency

On Mon, Jan 1, 2024, 8:31 PM Ahmad Hussnain @.***> wrote:

hi @ahmadhuss https://github.com/ahmadhuss did you eventually find the solution? because i got the same problem

Hi, @pullstacker https://github.com/pullstacker I haven't found any solution to this problem.

— Reply to this email directly, view it on GitHub https://github.com/Uniswap/routing-api/issues/115#issuecomment-1873329679, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6THJIHA3FSRQFR3BWK6AN3YMK3DHAVCNFSM6AAAAAAU4UIYDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGMZDSNRXHE . You are receiving this because you were mentioned.Message ID: @.***>

ahmadhuss commented 8 months ago

i just solved this issue last night, for me it was because wrong rpc and chainid variables in .env, perhaps you can double check everything related to those variables. also ensure your chainid included in smartorderrouter dependency

On Mon, Jan 1, 2024, 8:31 PM Ahmad Hussnain @.***> wrote:

hi @ahmadhuss https://github.com/ahmadhuss did you eventually find the solution? because i got the same problem

Hi, @pullstacker https://github.com/pullstacker I haven't found any solution to this problem.

— Reply to this email directly, view it on GitHub https://github.com/Uniswap/routing-api/issues/115#issuecomment-1873329679, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6THJIHA3FSRQFR3BWK6AN3YMK3DHAVCNFSM6AAAAAAU4UIYDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGMZDSNRXHE . You are receiving this because you were mentioned.Message ID: @.***>

Thanks for this information.

ProtonAnwar commented 7 months ago

Hi, There is a problem that I am trying to figure out since 1 day, the APIs are successfully deployed on AWS. But during API calls It returns an internal server error in response. I followed the steps in the documentation which is connected to an AWS account and it deployed successfully. Can you help me to understand the aws arn to how to add key value credential in secret manager arn and also how to rpc add in env.