How can I get final URL of newly added node from hook_node_insert()? I have installed pathauto and implemented hook_node_insert in my module, the problem is when I use entity_uri to get new node's URL I will get node/xxx instead of pathauto url alias.

How can I get final URL of the node, after ALL other modules had their manipulations?

function HOOK_node_insert($node) {
    $uri = entity_uri('node', $node);
    $uri['path']; // this should be the final path
}
If you also implement hook_module_implements_alter then you can change when your insert hook fires, like this:

function mymodule_module_implements_alter(&amp;$implementations, $hook) {
    if ($hook == 'node_insert') {
    // Move my_module_node_insert() to the end of the list. 
    $group = $implementations['my_module'];
    unset($implementations['my_module']);
    $implementations['my_module'] = $group;
  }
}


So now when your insert code executes the path alias should be available.