@Zaid Khan Thanks for reaching out. In the scenario where you are observing 500 error the suggestion would be to review the application insights log of your function app to know the root cause of the issue. As @Bruno Lucas mentioned that there could be a scenario where there can some settings in your local.settings.json which might be missing from your function app causing this behavior.
Other scenarios can be if you are using dependencies like library etc. and the dependency is not installed correctly on your function app resulting in 500 errors. In case if application insights logs didn't help then you can also review the diagnostic and solve problem blade on your function app to know the root cause.
If the above doesn't help then please refer to my private comment and share your function app name so I can assist you further.