Hi @Ananya Dixith - The above doesn't provide much insight further and only points that somewhere the request is getting malformed or probably some URI.
Had it been any request ID (typically ending with 6 0's, it would have pointed to be failing on the storage however the source in exception pointing to some app endpoint which is confusing.
As you mentioned in the initial verbatim that while providing directly it works correctly so you can try debugging to see what the URL is being formed on the failing instance to compare with the working scenario.
The last resort will be to reach out the Logic App Support via a support case to take a closer look and help in further troubleshooting/resolution.
Kindly let me know for any further queries and will be glad to assist.
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.