[NUI] Request failure after a few hundred requests

We are using NUI for character creation and thus there are thousands of options to go through. I haven’t been able to figure out an exact number or time, but it seems after a few hundred requests, they fail. All that is received is a generic “Network error” with an http status of 0 and no text.I have experienced this with both axios and jQuery.

Here is what we get:

Some sample code:

Don’t mind the mess, just have really been trying to figure this out.

import $ from 'jquery'

class http {
    public static post<T = string>(url: string, data: any): Promise<{ data: T }> {
        return new Promise((resolve, reject) => {
            console.log(`^2Sending request to http://skin_new/${url}^0`)
            if(data === undefined) {
                data = {}
            }
            $.post(`http://skin_new/${url}`, JSON.stringify(data)).done((data) => {
                if(typeof data !== "string") {
                    data = JSON.stringify(data)
                }
                console.log(typeof data)
                console.log('JQUERY DONE REQUEST')
                const retObj: { data: T } = { data }
                resolve(retObj)
            }).fail((e) => {
                console.log('JQUERY FAIL')
                reject(e)
            }).catch((e) => {
                console.log('JQUERTY CATCH', url)
                console.log(JSON.stringify(e), null, 2)
                reject(e)
            })
        })
    }
}
        async updateClothingItem(cat, item) {
            try {
                await http.post('clothing/update', {item: item[cat].hash})
            } catch (e) {
                console.log(JSON.stringify(e, null, 2))
            }
        }
RegisterNUICallback('clothing/update', function(data, cb)
    cb()
 --- ...... [clothing update code]

Would “nil” be a valid object to return here?

I don’t care about what the return data is. Everything is setup async for the time being just for when I implement actually waiting for the component(s) to load.

Good that you don’t care, but it might be the runtime won’t like it when you don’t specify any argument at all.

Interesting. I’ll try passing an empty string and come back with the results

For the time being, it appears this has solved the issue, but will keep an eye on it. Thank you.

After more thorough use, the issue is still present. Any calls with cb() have been replaced with cb('').

What does the Chrome DevTools UI show for these requests?

Still waiting for this to happen again. I’ve performed 10k+ requests with the Chrome Devtools UI opened and it failed to fail. I haven’t made any changes.

I went through every request in every script and checked to make sure it was responding and made sure it was at least responding with an empty string and haven’t had the issue.