Skip to content

chore: update hono and improve proxies #450

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

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/mail-bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@u22n/tsconfig": "^0.0.2",
"@u22n/utils": "workspace:*",
"drizzle-orm": "^0.30.3",
"hono": "^4.2.8",
"hono": "^4.3.6",
"mailauth": "^4.6.5",
"mailparser": "^3.6.9",
"mysql2": "^3.9.7",
Expand Down
2 changes: 1 addition & 1 deletion apps/storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@u22n/database": "workspace:*",
"@u22n/tsconfig": "^0.0.2",
"@u22n/utils": "workspace:*",
"hono": "^4.2.8",
"hono": "^4.3.6",
"sharp": "^0.33.2",
"unstorage": "^1.10.2",
"zod": "^3.23.8"
Expand Down
5 changes: 2 additions & 3 deletions apps/storage/proxy/attachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,13 @@ export const attachmentProxy = new Hono<Ctx>().get(
Key: `${orgPublicId}/${attachmentId}/${filename}`
});
const url = await getSignedUrl(s3Client, command, { expiresIn: 3600 });
const res = await fetch(url);
const res = await fetch(url).then((res) => c.body(res.body, res));
if (!res.ok) {
return c.json(
{ error: 'Error while fetching attachment' },
{ status: 500 }
);
}
// Copy response as fetch headers are immutable
return new Response(res.body, res);
return res;
}
);
5 changes: 2 additions & 3 deletions apps/storage/proxy/avatars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ export const avatarProxy = new Hono<Ctx>().get('/:proxy{.+}', async (c) => {
const proxy = c.req.param('proxy');
const res = await fetch(
`${env.STORAGE_S3_ENDPOINT}/${env.STORAGE_S3_BUCKET_AVATARS}/${proxy}`
);
).then((res) => c.body(res.body, res));
if (res.status === 404) {
return c.json({ error: 'Not Found' }, { status: 404 });
}
// Copy response as fetch headers are immutable
return new Response(res.body, res);
return res;
});
2 changes: 1 addition & 1 deletion ee/apps/billing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@u22n/database": "workspace:*",
"@u22n/tsconfig": "^0.0.2",
"@u22n/utils": "workspace:*",
"hono": "^4.2.8",
"hono": "^4.3.6",
"nitropack": "^2.8.1",
"stripe": "^14.17.0",
"superjson": "^2.2.1",
Expand Down
45 changes: 17 additions & 28 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.