Preprocess Node function not being called I'm attempting to perform an action in a preprocess node hook inside my .theme file, but I can't seem to get it to fire.

Here's the content of my customtheme.theme file

&lt;?php

function mytheme_preprocess_page(&amp;$variables){

    $menu = \Drupal\block\Entity\Block::load('custom_main_menu');

    $variables['main_menu'] = \Drupal::entityTypeManager()
        -&gt;getViewBuilder('block')
        -&gt;view($menu);
}

function mytheme_preprocess_node(&amp;$variables){
    die('Test');
}


Everytime I load a node, even though I have a die() statement in my mytheme_preprocess_node function it never fires, and the page loads just fine. I'm making sure that I'm loading pages that are nodes. Such as basic pages, and other custom content types. What's odd is that the mytheme_preprocess_page function does fire. It's able to load the main_menu variable inside the page.html.twig template just fine. I also made sure I was clearing the cache.

Why would a preprocess_page hook function fire but not a preprocess_node function.
You need check your page url. Hook_preprocess_node only run with page is node (example node/1...) or page have content is node (example page views have entity is node). If you done, you need clear cache.