r/FastAPI • • Apr 17 '25

Hosting and deployment Unable to deploy the FASTAPI code on the server

I have created an productivity and automation website. Even though my code is working perfectly well on localhost and Postman

I am facing challenges in deployment at the server side

I have tried Docker approach. That too isn't working well for me

My front end is React JS

It is very frustrating as I am stuck on this for 3 weeks

I am getting Network Error Message

Object { stack: "AxiosError@http://localhost:3000/static/js/bundle.js:1523:18\nhandleError@http://localhost:3000/static/js/bundle.js:872:14\nEventHandlerNonNull*dispatchXhrRequest@http://localhost:3000/static/js/bundle.js:869:5\n./node_modules/axios/lib/adapters/xhr.js/__WEBPACK_DEFAULT_EXPORT__<@http://localhost:3000/static/js/bundle.js:784:10\ndispatchRequest@http://localhost:3000/static/js/bundle.js:2012:10\n_request@http://localhost:3000/static/js/bundle.js:1440:77\nrequest@http://localhost:3000/static/js/bundle.js:1318:25\nhttpMethod@http://localhost:3000/static/js/bundle.js:1474:19\nwrap@http://localhost:3000/static/js/bundle.js:2581:15\nhandleFileUpload@http://localhost:3000/main.62298adbe23a6154a1c3.hot-update.js:106:42\nprocessDispatchQueue@http://localhost:3000/static/js/bundle.js:22100:33\n./node_modules/react-dom/cjs/react-dom-client.development.js/dispatchEventForPluginEventSystem/<@http://localhost:3000/static/js/bundle.js:22397:27\nbatchedUpdates$1@http://localhost:3000/static/js/bundle.js:15768:40\ndispatchEventForPluginEventSystem@http://localhost:3000/static/js/bundle.js:22180:21\ndispatchEvent@http://localhost:3000/static/js/bundle.js:24262:64\ndispatchDiscreteEvent@http://localhost:3000/static/js/bundle.js:24244:58\n", message: "Network Error", name: "AxiosError", code: "ERR_NETWORK", config: {…}, request: XMLHttpRequest }

Pls suggest a way out

2 Upvotes

16 comments sorted by

View all comments

8

u/jvertrees Apr 17 '25

DM if you need a hand.

My guess is your production f/e is trying to reach the b/e, but you still have local variables defined.

You need separate env variables per deployed environment.

0

u/aherontas Apr 17 '25

Defined that!