Try ERPNext Buy Support Partners Foundation

504 Timeout on doc submit

When i try to submit a document (Purchase Invoice), i receive a timeout error
I can see the POST request in browser network console to this endpoiont

/api/method/frappe.desk.form.save.savedocs

And after a long time i receive this error in console

POST https://next.ricompro.it/api/method/frappe.desk.form.save.savedocs 504 (Gateway Time-out)

save.js:217 Uncaught TypeError: Cannot read property ‘exc’ of null
at Object.always (save.js:217)
at Object. (request.js:260)
at i (jquery.min.js:2)
at Object.fireWith [as rejectWith] (jquery.min.js:2)
at z (jquery.min.js:4)
at XMLHttpRequest. (jquery.min.js:4)

And i can find the timeout in NGINX logs, but nothing in erpnext logs.

How can i debug the timeout?

I two face same error while saving the Purchase Receipt