Hello
The certificate must be in PEM format, as you can see in the function you are indicating you will provide a PEM certificate but the you provide a .cer, and also, since you are not providing any path on it, then it will assume the certificate is located in the script folder and that is not correct, so the solution here is to get the PEM certificate and when adding the path, use the full path where the .pem is stored.
hope this helps