Random timeout on GET request with Axios - wordpress

I have multiple sites buildt with static sites generator (gridsome, vue based).On build, they consume WP REST API data through Axios.
Lately, my build would fail a lot because Axios requests get randomly timedout.
On the WP side, each request made by axios is returning a 200 response, the body of the response is well formed. Nothing odd.
But Axios will randomly receive nothing...
I don't know where to search since the requests are returning 200, what could go wrong between the response (being 200) and Axios ?
Additional clues :
I never have these timeout using postman, or my browser
The endpoints in WP REST API that timeouts are random
I use REST API LOG to monitor the states of the requests on WP side
No matter the timeout configured on axios, it just never get the response
Any help will be appreciated !
Thanks for your time

This was an issue with Axios indeed.
Axios in his 0.19 version returned timeouts where they might be other errors involved.
I updated it to v0.22, that show me another error : some JSON response were truncated and not able to be parsed.
Related issues on github :
https://github.com/axios/axios/issues/2590
https://github.com/axios/axios/issues/1545
I had to switch from axios to node-fetch.

Related

GET Request to the Notion Database API throwing 401 status code (using reqwest)

I'm working on a wasm rust app with Yew, and trying to retrieve database entries from Notion to fill the app's body content. I'm using reqwest to do all the http requesting part, but no matter what I do it keeps returning a 401 status code. I've tried the same reqwest both on postman and curl and it worked, so the bearer auth token and url should be correct.
Here's what the code looks like:
let client = reqwest::Client::new();
let request = client
.get(NOTION_URL)
.bearer_auth(NOTION_TOKEN)
.header("Notion-Version", NOTION_VERSION)
.fetch_mode_no_cors()
.build()
.unwrap();
let response = client.execute(request).await.unwrap();
I've tried logging NOTION_URL, NOTION_TOKEN, NOTION_VERSION env variables to be sure that they are correct, and they are.
I've tried different things, like adding additional headers like accept or user-agent but the result is the same. Also tried to set the client's default headers with both the notion version and auth headers without success.
My guess is that maybe the fetch_mode_no_cors() is the culprit, but without it the request doesn't even go through, and I can't find any alternative to this method.
I'm kinda lost tbh, don't know where to find a solution so here we go!
Thanks!

how to fix the bug found during SOAPUI security testing

I was doing a automation testing on my web application with SOAPUI, I have found a bug which is http method fuzzing basically it means "HTTP Method Fuzzing
An HTTP Method Fuzzing Scan attempts to use other HTTP verbs (methods) than those defined in an API. For instance, if you have defined GET and POST, it will send requests using the DELETE and PUT verbs, expecting an appropriate HTTP error response and reporting alerts if it doesn't receive it.
Sometimes, unexpected HTTP verbs can overwrite data on a server or get data that shouldn't be revealed to clients."
Can anyone knows how I can solve this issue or how I block the HTTP request other than GET or POST which may remove this bug.
I am using Node.js and express for my web application.
Please check the images:
Image 1
Image 2

Axios post request in react-native app

I'm using axios in my react-native app, but I can't make any POST request in android simulator/device. It always return 400 Bad Request from the server.
I've tried to set Content-Type: application/json on headers but it didn't work as well.
on postman the request works as expected.
here's the request config object:
As you know, 400 Bad Request error means that the request you sent to the website server was somehow incorrect or corrupted and the server couldn't understand it.
I think there maybe problems on your request like as wrong URL or params or header format...
PS. Axios post methods syntax is as follows:
axios.post(url[, data[, config]])
You can test any axios method here and put it into your code base after it works.

Partial Response received from Apigee

The flow is SAP NWAS 7/Java AS ---> Apigee On Premise--->Apigee OnCloud -----> Backend. and back.
Backend is posting a response of appx 17 MB back. I have streaming enabled both on cloud and on premise Apigee. But the sap NWAS client states that only partial response is received .
When we invoke from POSTMAN however, we are getting complete response.
Please suggest where the problem can be?
Since Postman works fine for you, it seems like it might be a problem on the client side. So, it's possible that the client requires more info on the response in order to be able to display the content e.g. Content-Type header. Another way to troubleshoot this issue is to send a cURL command to the resource in Apigee and store it in the filesystem to validate that not only Postman can parse the response. e.g.
curl http://yourresourcehere/images/12344 > img12344.png

400 Bad Request From users/show.json twitter request

I'm using Twitter OAuth provider to login to my site. This works great; I can login, and get the access token. I want to make an additional request to the server to grab some user information. Using the 1.1 API, I do:
var request = HttpWebRequest.Create("https://api.twitter.com/1.1/users/show.json?screen_name=name");
var response = request.GetResponse(); //400 bad request error
Again, I've successfully logged in, and at this point, I have not made any successful requests, so I'm not being rate limited. Any idea what my problem is?
I can make the previous API work fine, using the URL: http://api.twitter.com/1/users/show.json?screen_name=name. But not the new URL.
Thanks.
According to the Twitter Developers Documentation for response codes, you get a 400 in this case :
The request was invalid. An accompanying error message will explain
why. This is the status code will be returned during version 1.0 rate
limiting. In API v1.1, a request without authentication is considered
invalid and you will get this response.
Seeing your code (your URL is right and you use the 1.1 version of the API) I think that you forgot to authorize the request.

Resources