Skip to content
This repository has been archived by the owner on Jan 28, 2025. It is now read-only.

fix(lambda-at-edge): fix dynamic route precedence conflicting with fallback pages #714

Merged
merged 2 commits into from
Oct 27, 2020

Conversation

dphang
Copy link
Collaborator

@dphang dphang commented Oct 27, 2020

Fixes: #646

  • Before fallback page is returned, we need to check for non-dynamic and dynamic routes that match it that may not be fallback.
  • Non-dynamic routes are already checked; this PR adds checking for dynamic routes as well.

A bit strange to mix this with static fallback logic, but the issue is fallback is checked early in the routing logic before any non-dynamic or dynamic routes, hence we need to check this as part of it. Will revisit this and do a cleaner refactor once we decouple Lambda@Edge and core routing logic.

Tests

Added some end-to-end tests to verify this behavior.

@codecov
Copy link

codecov bot commented Oct 27, 2020

Codecov Report

Merging #714 into master will increase coverage by 0.03%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #714      +/-   ##
==========================================
+ Coverage   79.79%   79.83%   +0.03%     
==========================================
  Files          55       55              
  Lines        1747     1765      +18     
  Branches      373      378       +5     
==========================================
+ Hits         1394     1409      +15     
- Misses        295      298       +3     
  Partials       58       58              
Impacted Files Coverage Δ
...ackages/libs/lambda-at-edge/src/default-handler.ts 94.46% <83.33%> (-0.86%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0b91309...b08d0a2. Read the comment docs.

@danielcondemarin danielcondemarin merged commit e667e76 into master Oct 27, 2020
@delete-merged-branch delete-merged-branch bot deleted the dphang/fix-dynamic-routing-precedence branch October 27, 2020 17:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Catch-all at /pages root breaks static file serving
2 participants