Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AxiosError: read ECONNRESET #13694

Closed
2 tasks done
Sanoodia opened this issue Apr 4, 2024 · 5 comments
Closed
2 tasks done

AxiosError: read ECONNRESET #13694

Sanoodia opened this issue Apr 4, 2024 · 5 comments
Labels
functions Issues tied to the functions category pending-response Issue is pending response from the issue author pending-triage Issue is pending triage

Comments

@Sanoodia
Copy link

Sanoodia commented Apr 4, 2024

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

18.12.0

Amplify CLI Version

12.8.2

What operating system are you using?

Window

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

Created a lambda function and im using axios call of curl operation on dynamodb using appsync graphql api.

Describe the bug

On peak time on lambda, axios call gives ECONNRESET on calling appsync graphql api

Expected behavior

It should perform action like update, delete or create

Reproduction steps

  1. created lambda by amplify cli
  2. add axios package
  3. use axios post call for updating or getting record by using appsync graphql api
  4. some time axios gives ECONNRESET error

Project Identifier

report-1712217332691.zip

Log output

# Put your logs below this line


Additional information

Using Node 18x Commonjs in lambda and axios 1.6.8v
here is my sample code

const axiosInstance = axios.create({
  baseURL:process.env.API_CATHERD_GRAPHQLAPIENDPOINTOUTPUT,
  headers: {
    Authorization: "MY_TOKENXXX",
  },
  method: "post"
});

const updateDrDeck = async (actionInfo, _input, _num_attempt = 0 ) => {
  console.log('_input',_input)
  try {
    if(_input?.cat?.includes("CT#") && _input?.id?.includes("CT#")){
      logEvent({...actionInfo, ActionType: 1001, ActionInfo: JSON.stringify(actionInfo)}, 
      process.env.STORAGE_PDEVENTS_NAME)
    }
    let response = await axiosInstance({
      data: {
        query: print(
          gql`
            ${updateCatHerd}
          `
        ),
        variables: {
          input: _input,
        },
      },
    });
    console.log('DD Updation response', response?.data, response?.errors);
    if (response?.data?.data) console.log("Solution: ", response.data.data);
    else console.log("Unable to update object", _input);
  } catch (err) {
    console.log("Error Updating DrDeck", err);
    return err;
  }
};

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@Sanoodia Sanoodia added the pending-triage Issue is pending triage label Apr 4, 2024
@ykethan
Copy link
Member

ykethan commented Apr 4, 2024

Hey @Sanoodia, thank you for reaching. Is this occurring on a amplify mock function?
If this is on the Lambda invocation on the console, implementing a error handling and retry logic may help in mitigating this behavior, refer to the Lambda documentation providing additional information. If this does not mitigate the issue, I would suggest reaching out to AWS technical support for Lambda for a deeper investigation.

@ykethan ykethan added functions Issues tied to the functions category pending-response Issue is pending response from the issue author labels Apr 4, 2024
@Sanoodia
Copy link
Author

Sanoodia commented Apr 8, 2024

here are the logs of my axio request
Error: read ECONNRESET
at AxiosError.from (/opt/nodejs/node_modules/axios/dist/node/axios.cjs:836:14)
at RedirectableRequest.handleRequestError (/opt/nodejs/node_modules/axios/dist/node/axios.cjs:3086:25)
at RedirectableRequest.emit (node:events:517:28)
at RedirectableRequest.emit (node:domain:489:12)
at eventHandlers. (/opt/nodejs/node_modules/follow-redirects/index.js:38:24)
at ClientRequest.emit (node:events:517:28)
at ClientRequest.emit (node:domain:489:12)
at TLSSocket.socketErrorListener (node:_http_client:501:9)
at TLSSocket.emit (node:events:517:28)
at TLSSocket.emit (node:domain:489:12)
at Axios.request (/opt/nodejs/node_modules/axios/dist/node/axios.cjs:3876:41)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async getPaginatedData (/opt/envHelpers.js:84:22)
at async Object.getLoadById (/var/task/sync_sdk.js:162:16)
at async exports.handler (/var/task/index.js:464:30)

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Apr 8, 2024
@ykethan
Copy link
Member

ykethan commented Apr 8, 2024

@Sanoodia thank you for providing the log, the error read ECONNRESET indicated an network/connection to a server was reset while the request was being made on the AWS Lambda. The AWS technical support for Lambda should be able to assist you in diving deeper on the service side.

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Apr 8, 2024
@ykethan
Copy link
Member

ykethan commented May 3, 2024

Closing the issue due to inactivity. Do reach out to us if you require any assistance.

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2024
Copy link

github-actions bot commented May 3, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
functions Issues tied to the functions category pending-response Issue is pending response from the issue author pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

2 participants