Python requests.timeout not working in Virtual Box VM - python-requests

I have an electron app that automatically runs a Django (Python) server. This server contains REST APIs that the frontend of the electron app calls.
The behavior of the APIs is that they are acting as "bridges" between the frontend and an online API. Basically, the flow is:
Frontend calls the Django server -> Django server calls an Online API, via requests library in Python -> Online API returns a response to the Django server -> Django server returns a response back to the Frontend.
The requests call made by the Django server to the Online API has a timeout of 20 seconds. The expected behavior is that if the Django server is calling an Online API and the internet is cut off, the Django server will timeout after 20 seconds and will return back a response to the Frontend.
This (i.e. the timeout) is already working if the electron app is ran outside a VM but inside the VM, it's not ending in 20 seconds.
What might be the problem?

Related

Is it possible to implement browser notifications with Laravel API running on one subdomain and the VUE client app on another subdomain

I am implementing a VUE client app running on subdomain client.example.com and Laravel API on api.example.com. I am using webpush package to implement the browser notifications. I have my service worker (sw.js) on my vue app and manages to register the user, store the data to database on the push_notifications table.
The problem comes when I simulate the notification, it is not sent to the browser. I tend to think may be it is because the client app that requested for the permission is different from the API subdomain that triggers the notification.
Is there any way to implement this or my worries not realistic?

Extending NextJS's middleware timeout

I am fairly experienced with Node, Express, and React but new to Next.
I am using Next's middleware to re-write API requests to my backend server (using NextResponse.rewrite).
I am not using Next's API functionality.
I am planning to deploy the app to Vercel.
Some of my APIs need more than 60 seconds to respond. From Vercel's Limits Doc, I see that the middleware function timeout is 30 seconds. Does it apply to rewritten requests (proxied to the backend) as well? If yes, is there a way to extend this? Without it, a Vercel deployment is out of the question and I will have to self-host Next which involves a lot more infra management.

Can I host my next.js on AWS lambda edge and have a separate API server?

Next.js is about server side rendering. Therefore have the render server (rendering the HTML) along with the API server seems to be a natural choice— it probably makes the rendering time much lower than having a separate API server (service)
That’s what I am thinking of theoretically.
But I would like to know if next.js applications are typically deployed in this way (a node server host both the api service and the next.js app).
Or does it make sense to have one service host the next.js app and another service host the rest api endpoints. e.g
Next.js is hosted on lambda edge
Api service hosted on api-gateway (+ lambda + dynamodb)
Lambda#Edge functions can only operate for a maximum of 5 seconds for viewer request functions and 30 seconds for origin request functions, so it's probably not practical to have the entire Next.js app on Lambda#Edge.
You could have individual portions of the app's logic on Lambda#Edge, but you also need to think about total package size because there are restrictions there as well.

Firebase authentication with SSR apollo react app

I have a SSR react app that uses apollo. My app server lives under one domain using express while the graphql server is under another domain. I'm having issues trying to understand how the authentication should work.
Currently on my app server I create a cookie session via firebase's documentation. All is fine with that, but I have a couple questions.
I'm currently using firebase's admin SDK to authenticate the request both on the app server and graphql server. I'm doing this because the initial SSR page gets rendered on the server, while all subsequent requests go directly do the graphql server. The redundancy of the authentication doesn't seem to be the right way to do this. Can someone verify?
If this isnt' the right way to do things, should I set up a simple proxy for all graphql requests from my. Essentially making all graphql request going from the client to my app server, which then goes to the graphql server under the hood?
Any other recommendations how to properly set this up? I'm at a complete loss here

WCF Service in Firebase

I have hosted my WEB APP in firebase. It consists of a WEB APP that calls a WCF Service also hosted in firebase.
The problem is that at the time of calling service, firebase returns 404 error.
The app and the service work perfectly in my local IIS, so it's not a code error.
I commented to them that the error that it gives me is that it does not find this page (404) when in fact I would be returning the result of my query.
https://recoveryerpwcf.firebaseapp.com/General.svc/Select?tabla=Compania&codigo=0&columnas=%5BCodigoAgrupado%5D%7C%7C%5BDescripcionAgrupada%5D&filtro=&columnasf=%5BDescripcionAgrupada%5D&top=999&_=1528745507843
Firebase Hosting can serve static assets, and (by connecting it to Cloud Functions) Node.js scripts.
There is no way to host a WCF service in Firebase.

Resources