.pem keys not working

I need .pem keys for JWT. Tests will never connect to the external service (calls are patched), however I still need to generate JWT tokens or I would need to patch way too much, and leave some code untested.

By default server uses keys inside

I’ve tried adding keys inside Environment Variables but for some reason it keeps throwing errors (ValueError: Could not unserialize key data.) on load_pem_public_key.

I cannot reproduce this error on my local machine (development, staging and production servers have no issues as well).

I’ve tried to SSH inside, set keys manually and run tests, but same issue.

Might not be CircleCI issue, but this is the only situation where it happens.