Skip to content

Comments

fix(cdn): use purge by key endpoint#2931

Closed
JacobCoffee wants to merge 1 commit intomainfrom
purge-fix
Closed

fix(cdn): use purge by key endpoint#2931
JacobCoffee wants to merge 1 commit intomainfrom
purge-fix

Conversation

@JacobCoffee
Copy link
Member

Description

  • surrogate key purge was hitting the singlw purge endpoint instead of purge-by-key

Copilot AI review requested due to automatic review settings February 21, 2026 18:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the GitHub Actions Fastly purge workflow to target a purge-by-key mechanism for surrogate key invalidation.

Changes:

  • Switches the Fastly API request from .../purge/{KEY} to .../purge and adds a Surrogate-Key request header.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +27 to +29
"https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge" \
-H "Fastly-Key: ${{ secrets.FASTLY_API_KEY }}" \
-H "Surrogate-Key: ${{ env.KEY }}"
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow now POSTs to /service/${FASTLY_SERVICE_ID}/purge with a Surrogate-Key request header and no body. Elsewhere in this repo, surrogate-key purging is implemented as a POST to /service/{service_id}/purge/{key} (see fastly/utils.py:44-48), so this change likely breaks purging (or at least makes it inconsistent with the app’s purge behavior). Recommend switching back to the /purge/${KEY} endpoint, or if you intend to use the multi-key purge endpoint, send the expected JSON payload and required headers (e.g., content-type) instead of only Surrogate-Key.

Suggested change
"https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge" \
-H "Fastly-Key: ${{ secrets.FASTLY_API_KEY }}" \
-H "Surrogate-Key: ${{ env.KEY }}"
"https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge/${{ env.KEY }}" \
-H "Fastly-Key: ${{ secrets.FASTLY_API_KEY }}"

Copilot uses AI. Check for mistakes.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 565d1e3b38

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +27 to +29
"https://api.fastly.com/service/${{ secrets.FASTLY_SERVICE_ID }}/purge" \
-H "Fastly-Key: ${{ secrets.FASTLY_API_KEY }}" \
-H "Surrogate-Key: ${{ env.KEY }}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Put surrogate key back into the Fastly purge endpoint

The workflow now posts to .../service/{id}/purge and sends the key only via Surrogate-Key header, but Fastly surrogate-key purging expects the target key to be part of the purge-by-key request path; with curl -f this causes the step to fail on every push/dispatch and prevents cache invalidation for the selected target.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant