Call frappe.get_last_doc(doctype) with frppe.call give permission error

I am trying to use frappe.get_last_doc(doctype)
to get last created doc via custom script

frappe.call({
    method:"frappe.get_last_doc",
    args: {doctype:"Sales Invoice"}, 
    callback: function(r) { 
        console.log(r.message);
    }
})

Error

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 61, in application
    response = frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 21, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 54, in execute_cmd
    is_whitelisted(method)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 76, in is_whitelisted
    raise frappe.PermissionError('Not Allowed, {0}'.format(method))
PermissionError: Not Allowed, <function get_last_doc at 0x7f69c9af16e0>

get_last_doc method is not whitelisted. You cannot call it from the client side.
You should use frappe.db.get_list in combination with frappe.db.get_doc to get what you want.