Skip to content

feat: match edge functions by header#7439

Merged
eduardoboucas merged 5 commits intomainfrom
eduardo/run-1782-add-edge-function-matching-by-header-to-cli
Jul 18, 2025
Merged

feat: match edge functions by header#7439
eduardoboucas merged 5 commits intomainfrom
eduardo/run-1782-add-edge-function-matching-by-header-to-cli

Conversation

@eduardoboucas
Copy link
Member

Summary

Adds support for matching edge functions by header.

@eduardoboucas eduardoboucas requested a review from a team as a code owner July 18, 2025 12:35
@github-actions
Copy link

github-actions bot commented Jul 18, 2025

📊 Benchmark results

Comparing with 69134d2

  • Dependency count: 1,082 (no change)
  • Package size: 288 MB (no change)
  • Number of ts-expect-error directives: 399 (no change)

Copy link
Member

@serhalp serhalp left a comment

Choose a reason for hiding this comment

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

LGTM. just a couple suggestions.

return
}

if (route.headers && headers) {
Copy link
Member

Choose a reason for hiding this comment

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

🤔 what happens if route.headers but !headers? we might intend to match specific headers but we wouldn't run that logic? is !headers every expected? could we handle this more gracefully and explicitly?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we should ever hit !headers, though. Removed in 3cc29d0.

return pattern.test(headerValueString)
}

return false
Copy link
Member

Choose a reason for hiding this comment

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

am I reading correctly that this is an invalid user configuration? since we're in dev, it might be helpful DX to print a user warning in this case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really. This is an internal structure that has been generated from parsing the edge function files and the TOML config. If there's an error in syntax, it will be thrown by edge-bundler.

From my tests, we might need some additional logic to surface those errors better (unrelated to this PR), which I'll do in a follow-up.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I've done it in 7d6f789 because it's a small fix (and you now you're obliged to review!).

@eduardoboucas eduardoboucas merged commit 21e4bc5 into main Jul 18, 2025
67 of 68 checks passed
@eduardoboucas eduardoboucas deleted the eduardo/run-1782-add-edge-function-matching-by-header-to-cli branch July 18, 2025 15:20
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.

2 participants