I’m trying to publish my workers that uses secrets but it raise an error, it turns out that somehow secrets works with plain javascript but not with workers that bundled with webpack.
I manage to reproduce the issue in this repository.
Step by step to reproduce:
git clone https://github.com/pyk/cf-worker-secrets-test.git
cd with-webpack/
Rename the wrangler.toml.example
to wrangler.toml
and update YOUR_ACCOUNT_ID
and YOUR_ZONE_ID
.
Create the secret using the following command:
wrangler secret put MY_SECRET
Then publish the worker:
wrangler publish
Access https://cf-worker-secrets-test-with-webpack.YOURNAME.workers.dev
.
You should see an error.
Where project without webpack runs fine.
Am I missing something here?