Build secrets for preview workers

I have a worker that has both variables and secrets in the "Settings" panel for Worker Builds. In production builds everything's fine, but in preview builds, secrets appear empty. To check that I added an
env
call before builds and logging in the js code. This is what I see:

API_BASEURL=https://****/api/
API_SECRET_KEY=
...
Error: Invalid baseUrl or secretKey ("https://****/api/", "")


What can I do?
Was this page helpful?