Error 500 on SERVER: Server Error: Failed to find foremantest.corp.com via exec: Execution of '/etc/puppetlabs/puppet/node.rb foremantest.corp.com' returned 1:

Problem: Error While Running puppet agent -t on Puppet Master. (Puppet Master and Foreman is installed on same server) Error 500 on SERVER: Server Error: Failed to find “foreman Domain name” via exec: Execution of ‘/etc/puppetlabs/puppet/node.rb “foreman Domain name”’ returned 1:

Expected outcome:

Foreman and Proxy versions: 1.19

Foreman and Proxy plugin versions:

Other relevant data:
puppet agent -t
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: Error 500 on SERVER: Server Error: Failed to find “foreman Domain name” via exec: Execution of ‘/etc/puppetlabs/puppet/node.rb “foreman Domain name”’ returned 1:
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Failed when searching for node “foreman Domain name”: Failed to find foremantest.corp.com via exec: Execution of ‘/etc/puppetlabs/puppet/node.rb foremantest.corp.com’ returned 1:
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run