Environment variables not found when running with rcc

Running my robot in Robocorp Lab, everything works fine. But if I run the robot with rcc, environment variables can no longer be set…
on line 5: Setting variable ‘${firstname}’ failed: Environment variable ‘%{env_firstname}’ not found.

This is solved by passing rcc the --environment option like this:
--environment path/to/env.json