How to get the Published or Archived revision of a node
You can do this with a direct database query in your function, then load the specific revision.

$connection = \Drupal::database();
$query = $connection-&gt;query("SELECT vid FROM {node_field_data} WHERE nid = :nid",
    [':nid' =&gt; $node_nid,]);
$node_revision_id = $query-&gt;fetchField();

$node_revision = \Drupal::entityTypeManager()
  -&gt;getStorage('node')
  -&gt;loadRevision($node_revision_id);


Untested code, but this should put you on the right track.  Might also be worth confirming in your SQL query that "WHERE status = 1" to confirm that the node is still published.