Setting environment variables via API does not work for Bitbucket

We are trying to set environment variables on a project using the Circle API, and then follow it. The code works perfectly for GitHub repositories; however, the same code returns a 500 error for BitBucket projects.


If we visit the project in Circle CI using the web UI first, then the Circle API to set environment variables works fine. This is not a requirement for GitHub projects.

Is this a known bug, or is there something that we need to do to “create” the project on Circle before setting environment variables? We’d rather not follow the project before setting environment variables, because then we would get a failed build.