Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

Support Edge API Route and Edge Config as kv Store #881

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

aidenlx
Copy link
Contributor

@aidenlx aidenlx commented Feb 16, 2023

Description

Both changes should speed up the response time

Note
New features need to be explictly enabled via Edge Config with edge_runtime: true
Required Environment Variable: EDGE_CONFIG and VERCEL_TOKEN

Addition

Considering the nature of Edge Config, It's possible to migrate some config like protectedRoutes and clientId so that changing them won't require rebuilding the website

@vercel
Copy link

vercel bot commented Feb 16, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
onedrive-vercel-index ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 26, 2023 at 3:37PM (UTC)

@aidenlx aidenlx changed the title Support Edge Function and Edge Config Support Edge API Router and Edge Config as kv Store Feb 16, 2023
@aidenlx aidenlx changed the title Support Edge API Router and Edge Config as kv Store Support Edge API Route and Edge Config as kv Store Feb 16, 2023
@spencerwooo
Copy link
Owner

Thanks! I appreciate the effort. I've been meaning to do this myself.

One question: does dropping ioredis in favor of upstash/redis break support for ppl who use their own Redis instance? I think this would break a handful of sites and I'm inclined to leave this branch as a feature branch and be kept as is.

new api using edge runtime need to explictly enable via edge config (`edge_runtime: true`)
@aidenlx
Copy link
Contributor Author

aidenlx commented Feb 17, 2023

does dropping ioredis in favor of upstash/redis break support for ppl who use their own Redis instance?

In the latest commit I've hidden the new features behide flag so that it won't break existing websites. By default API requests is redirected to function with node runtime that uses ioredis as before, and the new features need to be explictly enabled via Edge Config with edge_runtime: true

@aidenlx
Copy link
Contributor Author

aidenlx commented Feb 18, 2023

BTW, although this PR no longer include breaking changes, and the logic of API should be the same, refactoring API with fetch API may introduce unexpected issues. Maybe you can help test it out before merging it if it's convenient for you?

@spencerwooo
Copy link
Owner

Noted, thanks for the effort. I'll review this asap ;)

@aidenlx
Copy link
Contributor Author

aidenlx commented Feb 26, 2023

CDN caching for raw file requests is implemented in cbedcf6. The redirect request is cached for one hour before expire time based on microsoft-graph API document

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.

None yet

2 participants