Skip to content

Commit

Permalink
changes encoding on cache.body from utf8 to base64
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanirion committed Dec 5, 2023
1 parent ba6e176 commit 18b793a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/open-next/src/adapters/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export default class S3Cache {
lastModified: LastModified?.getTime(),
value: {
kind: "ROUTE",
body: Buffer.from(cacheData.body ?? Buffer.alloc(0)),
body: Buffer.from(cacheData.body ?? Buffer.alloc(0), "base64"),
status: meta?.status,
headers: meta?.headers,
},
Expand Down Expand Up @@ -276,7 +276,7 @@ export default class S3Cache {
"cache",
JSON.stringify({
type: "route",
body: body.toString("utf8"),
body: body.toString("base64"),
meta: {
status,
headers,
Expand Down
4 changes: 3 additions & 1 deletion packages/open-next/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,9 @@ function createCacheAssets(monorepoRoot: string, disableDynamoDBCache = false) {
? JSON.parse(fs.readFileSync(files.json, "utf8"))
: undefined,
rsc: files.rsc ? fs.readFileSync(files.rsc, "utf8") : undefined,
body: files.body ? fs.readFileSync(files.body, "utf8") : undefined,
body: files.body
? fs.readFileSync(files.body).toString("base64")
: undefined,
};
fs.writeFileSync(cacheFilePath, JSON.stringify(cacheFileContent));
});
Expand Down

0 comments on commit 18b793a

Please sign in to comment.