I used a secured web printing service in a custom application developed using ArcGIS JS API. It was working fine and was printing all layers present on the map. However, recently I started receiving 400 and 500 errors while executing the print functionality.
Issue 1: FeatureLayer, MapImageLayer, and GraphicsLayer are displayed on the map with ArcGIS Online basemap imagery as the basemap. When executing the print, it gives the error: Unable to complete the operation (400). Whenever I exchange the imagery with another basemap, like the Light Gray Canvas, the service generates a map. After inspecting the Server Log, I cannot connect to the ArcGIS Online imagery service due to an invalid certificate error, as seen in the image below.

Issue 2: There is a result graphics layer where I add features intersecting with the users' input feature. The print functionality works whenever the result has a few features added to the layer. But when there are many intersecting features in the result layer, the print function gives a 500 (Internal Server Error), as seen in the image below.

If I hide the results layer, the print functionality works again, so it seems like there is a problem with the result layer, but I am not sure what it is. Is there a limit to the number of features the print function can print?
The print service is published as a secure service on a standalone ArcGIS Server instance of version 10.6.1