-
Notifications
You must be signed in to change notification settings - Fork 45
[BUG] R2 cache population #535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't think getPlatformProxy supports remote does it? If we can get the parsed wrangler config we could just grab the name from that to use as well |
The key problem likely applies to the other cache adapters as well |
I have a fix PR, will upload early afternoon! |
@james-elicx what was the rationale not to fallback to assets? as of today the cache assets are populated in R2 and uploaded in the assets - if we do not fallback they we do not need to have the assets. |
To use the data store as the single source-of-truth instead of mixing it with assets and having to do extra work to figure out when something in assets can be used or not. I was planning to change KV to do auto-population this week so that we can remove the need for storing them in assets completely. |
Thanks @james-elicx, makes sense. Do you have a tracking issue for that? I'd like to add a few minor fixes to both the handler, could be tackled at the same time if you have time. |
Just made #538 for it. |
populate cache
The command
opennextjs-cloudflate populateCache
populates a bucket namedNEXT_INC_CACHE_R2_BUCKET
.NEXT_INC_CACHE_R2_BUCKET
is actually the name of the binding rather than the bucket.We probably should use
getPlatformProxy()
to retrieve the binding and call.put()
on it. The command should take an env a directory to persist data.cache handler
getR2Key
returns${directory}/${process.env.NEXT_BUILD_ID ?? "no-build-id"}/${key}.${isFetch ? "fetch" : "cache"}
The
key
is typically/path/to/file.cache
so we will end up withBUILD_ID//key
which will not match the uploaded file.@james-elicx thoughts?
Edit: found while tackling #528
The text was updated successfully, but these errors were encountered: