This is an old question but given I have just faced the same problem myself I thought I would give my take on the answer.
sales_order_place_after is triggered before the order is saved to db so at the point your code is running the order entity ID doesn't exist. There are few options to work around this:
You could use
sales_order_save_after which is triggered after the order is actually persisted to db. This will allow you to have access to the order ID. This approach has risks however as it can be triggered again after the order is created. If you only want to run your code only once when the order is first placed, using this observer may have unexpected side effects.
Alternatively rather than using an observer you could create a plugin around
Magento\Sales\Api\OrderManagementInterface::place. This will allow you to do what I suspect you are trying to do with
As a rough example your modules
etc/di.xml would look something like this:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<plugin name="my-module-order-service" type="My\Module\Plugin\OrderServicePlugin" sortOrder="5"/>
And your plugin class like this:
public function aroundPlace(\Magento\Sales\Model\Service\OrderService $subject, \Closure $proceed, \Magento\Sales\Api\Data\OrderInterface $order)
$return = $proceed($order);
$orderId = $order->getEntityId();
// your custom code