Internal Server Error(500) for run_doc_method API's after changing site name manually

I came across 500 server error after changing the site name manually (using mv command).
The server is accessible through browser and even all ajax calls are working except “/api/method/run_doc_method”.

It’s only happening while saving “Customize Form” and “DocType” forms.

NOTES:
After changing site-name I did run following commands:

  1. bench setup nginx
  2. update the domains in site_config.conf files
  3. brew services restart nginx
  4. bench --site [new-site] migrate
  5. bench start

Console traceback:

Object { url: "/api/method/run_doc_method", data: {…}, type: "POST", dataType: "json", async: undefined, headers: {…}, cache: false }
​
async: undefined
​
cache: false
​
data: Object { docs: "{\"name\":\"Customize Form\",\"max_attachments\":0,\"allow_copy\":0,\"istable\":0,\"editable_grid\":0,\"quick_entry\":0,\"track_changes\":1,\"track_views\":0,\"allow_auto_repeat\":0,\"allow_import\":1,\"show_preview_popup\":0,\"email_append_to\":0,\"sort_order\":\"ASC\",\"doctype\":\"Customize Form\",\"fields\":[{\"name\":\"Sales Partner-partner_information\",\"parent\":\"Customize Form\",\"parentfield\":\"fields\",\"parenttype\":\"Customize Form\",\"idx\":1,\"docstatus\":0,\"label\":\"Partner Information\",\"fieldtype\":\"Section Break\",\"fieldname\":\"partner_information\",\"non_negative\":0,\"reqd\":0,\"unique\":0,\"in_list_view\":0,\"in_standard_filter\":0,\"in_global_search\":0,\"in_preview\":0,\"bold\":0,\"allow_in_quick_entry\":0,\"translatable\":0,\"precision\":\"\",\"length\":0,\"fetch_if_empty\":0,\"permlevel\":0,\"hidden\":0,\"read_only\":0,\"collapsible\":0,\"allow_bulk_edit\":0,\"ignore_user_permissions\":0,\"allow_on_submit\":0,\"report_hide\":0,\"remember_last_selected_value\":0,\"hide_border\":0,\"in_filter\":0,\"hide_seconds\":0,\"hide_days\":0,\"print_hide\":0,\"print_hide_if_no_value\":0,\"…", method: "save_customization" }
​
dataType: "json"
​
headers: Object { "X-Frappe-CSRF-Token": "fb6a2b27a2ecdafacc8b0465112ca18b663f8e51985c8a0feab3f507", Accept: "application/json", "X-Frappe-CMD": "" }
​
type: "POST"
​
url: "/api/method/run_doc_method"
​
<prototype>: Object { … }
request.js:247:9
XHRPOSThttps://portal.nav.com/api/method/run_doc_method
[HTTP/1.1 500 Internal Server Error 51ms]

Object { readyState: 4, getResponseHeader: getResponseHeader(a), getAllResponseHeaders: getAllResponseHeaders(), setRequestHeader: setRequestHeader(a, b), overrideMimeType: overrideMimeType(a), statusCode: statusCode(a), abort: abort(a), state: state(), always: always(), then: then()
, … }
​
abort: function abort(a)​
always: function always()​
complete: function add()​
done: function add()​
error: function add()​
fail: function add()​
getAllResponseHeaders: function getAllResponseHeaders()​
getResponseHeader: function getResponseHeader(a)​
overrideMimeType: function overrideMimeType(a)​
pipe: function then()​
progress: function add()​
promise: function promise(a)
​
readyState: 4
​
responseText: "<html>\r\n<head><title>500 Internal Server Error</title></head>\r\n<body>\r\n<center><h1>500 Internal Server Error</h1></center>\r\n<hr><center>nginx/1.21.0</center>\r\n</body>\r\n</html>\r\n"
​
setRequestHeader: function setRequestHeader(a, b)​
state: function state()
​
status: 500
​
statusCode: function statusCode(a)
​
statusText: "Internal Server Error"
​
success: function add()​
then: function then()​
<prototype>: Object { … }
request.js:275:11
Unable to handle failed response request.js:315:12
console.trace() SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
    call request.js:296
    jQuery 6
    call request.js:248
    call request.js:98
    call form.js:1439
    set_primary_action customize_form__js:286
    set_action page.js:254
    jQuery 2
request.js:316:12
    call request.js:316
    jQuery 6
    call request.js:248
    call request.js:98
    call form.js:1439
    set_primary_action customize_form__js:286
    set_action page.js:254
    jQuery 2
1 Like

I got a same problem, but i didn’t change anything. I only installed ERPnext v13. Is there a solution?
erpnext 13.15.2
frappe 13.15.0

I haven’t found any solution yet.
I am on v13.16 for both frappe and erpnext.

I tried few options: reinstalling the site, create a new site, tried to run the site without https, reinstalling the app, and setting up the new nginx config but nothing works for me.

It could be an issue with nginx configuration as this request isn’t making through backend. it’ll keep on failing on client side only due to which I can’t see any logs console.

try to use ngrok to point your local host to ngrok domain, and access it via .ngrok.io domain. this temp workaround works for me.