Could not get post ID from wp_insert_post()

Apparently there is nothing wrong with my script above. There is actually a conflict with another plugin which called the same 3rd party script twice via add_action( ‘save_post’, ‘function_name’). This double fired the 3rd party script and caused error when my script above try to do insert post.

I have turned on debug at wp-config.php by setting
define(‘WP_DEBUG’, true);
define(‘WP_DEBUG_LOG’, true);

and then solved the bugs via the error logs provided.