-
Notifications
You must be signed in to change notification settings - Fork 188
Description
Use case of creating a new version of the Worker and not deploy immediately is for each pull request to have a preview version.
Because the web app need secret to run in runtime, it is important that each worker version has the secrets. However, when attempt to upload a worker version together with the secrets (example below), the workflow will return error:
Script edit failed. You attempted to deploy the latest version with modified settings, but the latest version isn't currently deployed. Either upload a new version to edit the version settings, or use the script-level settings API (/workers/scripts/{script_name}/script-settings) to modify the "logpush" and "tail_consumers" settings. [code: 10214]
jobs:
upload:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- name: Upload Worker Version
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: versions upload
secrets: |
SUPER_SECRET
env:
SUPER_SECRET: ${{ secrets.SUPER_SECRET }}
Removing the secrets
and env
from the workflow will pass the version upload but the secrets will be missing from the version causing the web app to crash. Any idea how to overcome this limitation? Note that the secrets doesn't change per version and remains the same in the worker setting.