NathanLei
(NathanLei)
6 Dicembre 2019, 2:28pm
1
Quando provo a creare due post contemporaneamente tramite API, si verificano errori.
RangeError: Maximum call stack size exceeded
Mi chiedo se si tratti di un problema di configurazione o se l’API non supporti le richieste parallele.
Creo i post utilizzando Promise.all() tramite API.
david
(David Taylor)
6 Dicembre 2019, 2:29pm
2
Dove vedi quell’errore? Sospetto che provenga dalla tua applicazione client, non da Discourse.
NathanLei
(NathanLei)
6 Dicembre 2019, 2:38pm
3
questo è il mio codice..
let promise1 = post('posts', {
topic_id: 35,
raw: 'post1post1post1post1post1post1',
})
let promise2 = post('posts', {
topic_id: 35,
raw: 'post2post2post2post2post2',
})
try {
let r = await Promise.all([promise1, promise2]).then()
console.log('Risposta delle due richieste' + JSON.stringify(r) )
return r
} catch (error) {
console.log('errore' + JSON.stringify(error) )
}
il messaggio restituito è Request failed with status code 422"
david
(David Taylor)
6 Dicembre 2019, 2:41pm
4
422 probabilmente significa che la convalida sta fallendo durante il post. Dovresti registrare il corpo della risposta dalla richiesta HTTP e verificare qual è il messaggio di errore completo.
NathanLei
(NathanLei)
10 Dicembre 2019, 9:56am
5
Mi scuso, Discourse supporta le richieste parallele, è stata colpa mia. Scusa.