Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

289
Views
Catching an Error from axios.get() when bytes returned exceeds 1GB

I'm using axios to make an http GET request. In some situations my server is returning more than a GB of data causing an error. For a short term solution I want to catch the error and log it however I'm finding it difficult to catch the error. Using a .catch mentioned here, and in the axios documentation, I'm still unable to catch the error.

Error

buffer.js:776
    return this.utf8Slice(start, end);
                ^
Error: Cannot create a string longer than 0x3fffffe7 characters

Example Requests / What I've tried

// without a catch
const res = await axios.get<string, AxiosResponse<Record<string, any>>>("http://foo.bar/huge_string_response");

// with a catch, still throws
const res = await axios
    .get<string, AxiosResponse<Record<string, any>>>("http://foo.bar/huge_string_response")
    .catch((err) => {console.log("error: " + err); });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!