When I try to create two posts via API at the same time. errors happen

When I try to create two posts via API at the same time. errors happen
RangeError: Maximum call stack size exceeded

I wonder if this is a setting issue or the API doesn’t support Parallel request.

I create post with promise.all() via API.

Where do you see that error? I suspect it is coming from your client application, rather than Discourse.

1 Like

this is my code…

 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('两个请求的返回' + JSON.stringify(r) )
        return r
    } catch (error) {
        console.log('error' + JSON.stringify(error) )
    }

the reture message is Request failed with status code 422"

422 likely means that the validation is failing on the post. You should log the response body from the http request, and check what the full error message is.

4 Likes

I apologize, discourse support Parallel request, it was my bad. sorry

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.