Configure Class' Aren't Applying as Expected

I have a few custom modules which had been working fine until I started noticing changes weren’t filtering through to the nodes, with the agent debug not flagging any problems. What also strange was that removing puppet modules wasn’t possible either resulting “returned 500 Server Error” complaining that it couldn’t find a module even when that module wasn’t assigned to the node. I rejoined the node and left it blank with no configuration however it was still trying to pull through old config for modules that have been removed from the puppet server.

Expected outcome:

I expect that when there is no configuration assigned to the node, the agent shouldn’t be trying to apply changes. However it looks like it is trying to pick up some older config, even when the node has been deleted from foreman/puppet and the agent has it’s certificates removed. It still attempts to apply configuration that isn’t assigned to it.

Foreman and Proxy versions:

1.24.3 puppetserver version: 6.12.1

Foreman and Proxy plugin versions:

Distribution and version:

Centos 7 with SELinux

Other relevant data:

Debug: HTTP POST https://puppet:8140/puppet/v3/catalog/example.com?environment=production returned 500 Server Error

Debug: Caching connection for https://puppet:8140

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find class customModule for example.com on node example.com

Warning: Not using cache on failed catalog

Error: Could not retrieve catalog; skipping run