question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Request failed with status code 500

See original GitHub issue

Hi, When I try

axios.get(this.$server+'/transco/gettable/COREPDMINTERVALTYPO_INPUT')
      .then(function (response) {
        // handle success
        console.log(response);
      })
      .catch(function (error) {
        // handle error
        console.log(error);
      })
      .then(function () {
        // always executed
      });

I get error 500 :
GET http://localhost:8081/transco/gettable/TABLE_TEST 500 (Internal Server Error)

But if I do it directly (http://localhost:8081/transco/gettable/TABLE_TEST) in my browser it works.

I don’t know why can you help me ? thx

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
thib92commented, Jun 9, 2019

Once again, if you’re getting a 5xx error code, it’s due to your backend code. If it’s different from typing the URL by hand in the browser, check your backend code regarding request headers, cookies, etc. This has nothing to do with Axios.

0reactions
MohAbdelhamedcommented, Mar 18, 2020

The below worked with me: const deptsURL = “http://localhost:8099/ords/hr/hrm/depts”; var vAttributes = {}; vAttributes = { departmentid: model.attributes[model.idAttribute] , departmentname: $(“#newDepartName”).val() , managerid: 100 , locationid: 1700 }; const ops = { method: ‘POST’, headers: { ‘content-type’: ‘application/json’ }, data: JSON.stringify(vAttributes) , url: deptsURL }; axios( ops).then((res) => { console.log("post response: " + res); }).catch(function (error) { console.log("post error: " + error); });

Read more comments on GitHub >

github_iconTop Results From Across the Web

500 Internal Server Error - HTTP - MDN Web Docs - Mozilla
This error response is a generic "catch-all" response. Usually, this indicates the server cannot find a better 5xx error code to response.
Read more >
Axios POST request fails with error status code 500
Solution: In the catch block, the error which will always be 500 internal server error; so, use error.response.data instead of error . Code:...
Read more >
What Is a "500 Internal Server Error" and How Do I Fix It?
They indicate that the server failed to complete the request because server encountered an error. When you try to visit a website and...
Read more >
How to Fix a 500 Internal Server Error on Your WordPress Site
The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the ...
Read more >
HTTP 500 Internal Server Error: What It Means & How to Fix It
A 500 internal server error is, as the name implies, a general problem with the website's server. More than likely, this means there's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found