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

545
Views
Axios request in Expo React Native app returns unexpected 405 error

I'm developing a React Native app with Expo and I'm using Axios to try sending http requests. Unfortunately, for every request I get a 405 status response.

This is the axios instance I've created to manage the requests (API url replaced with dummy for security reasons):

    import axios from 'axios';

    const instance = axios.create({
        baseURL: 'https://actualapi.com',
        headers: {
            ['Content-Type']: 'application/json',
            'Access-Control-Allow-Origin': '*',
            'Access-Control-Allow-Methods': '*'
        }
    });

    export default instance;

The actual request (in a redux thunk function aka async action creator):

    axios
        .post(
            requestPath,
            // { withCredentials: true },
            { email: email }
        )
        .then((res) => {
            console.debug(JSON.stringify(res));
            checkEmailSuccess(res);
        })
        .catch((error) => {
            console.debug(error);
            checkEmailFail(error);
        });

The error for every single request:

Request failed with status code 405
at node_modules\axios\lib\core\createError.js:16:14 in createError
at node_modules\axios\lib\core\settle.js:17:22 in settle
at node_modules\axios\lib\adapters\xhr.js:66:12 in onloadend
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEventat node_modules\react-native\Libraries\Network\XMLHttpRequest.js:614:6 in setReadyState
at node_modules\react-native\Libraries\Network\XMLHttpRequest.js:396:6 in __didCompleteResponse
at node_modules\react-native\Libraries\vendor\emitter\_EventEmitter.js:135:10 in EventEmitter#emit       
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:414:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:113:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:365:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:112:4 in callFunctionReturnFlushedQueue
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

It was a wrong call. I was doing a POST instead of GET.

about 4 years ago · Santiago Trujillo Report
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!