Secrets in pages function only working from dashboard, not CLI

For Workes & Pages, what is the name of the domain?

coolcitycargo.com

What is the issue or error you’re encountering

Secrets are undefined in context.env when I add them from wrangler cli. Only works when I add them via the UI

What are the steps to reproduce the issue?

Add a secret via npx wrangler -e production secret put
Deploy via npx wrangler pages deploy
Attempt to access secret from context.env in a pages function.
Result: secret is undefined.
Repeat steps except instead of CLI use pages UI → Settings → Environment Variables.
Now the secret is available in the function.

I moved to managing environment variables via wrangler.toml and would prefer to use the CLI and npx wrangler secret put or npx wrangler secret bulk but I tried lots of things for hours and doing it via the UI was the only thing I could make work.
Also note that after doing a put or bulk I can list the secrets via the CLI but they are not accessible via context.env in the function.