Since Dataflow workers operate in a different environment than your local machine, they can't find files using relative paths. I think the best approach is to upload it to a Google Cloud Storage bucket like gs://your-bucket/your-cert.pem. Then, within your Apache Beam pipeline, you'll need to use the apache_beam.io.gcp.gcsio.GcsIO tool to read the content of this file from GCS and then pass that content to the tlsCertificateKeyFile setting for your MongoDB connection. Don't forget to give the Dataflow service account permission to access the file in GCS.