Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
averyyip committed Dec 4, 2023
1 parent 309903d commit dcc90cc
Show file tree
Hide file tree
Showing 4 changed files with 3,132 additions and 3,561 deletions.
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"with-env": "dotenv -e ../../.env --"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.465.0",
"@aws-sdk/client-s3": "3.428.0",
"@aws-sdk/client-sfn": "^3.462.0",
"@aws-sdk/client-sns": "^3.450.0",
"@aws-sdk/s3-request-presigner": "^3.465.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/api/src/services/blobStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ export const blobClient = (client: S3Client) => {

const getSignedUrl = async ({
key,
expiresInMs,
expiresInSecs,
}: {
key: string;
expiresInMs: number;
expiresInSecs: number;
}) =>
await s3GetSignedUrl(
client,
new GetObjectCommand({ Bucket: env.S3_BUCKET, Key: key }),
{ expiresIn: expiresInMs },
{ expiresIn: expiresInSecs },
);

const put = async ({
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/services/user-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ export const makeUserManager = () => {
const getUrl = async (id: UserId) => {
return blobStore.getSignedUrl({
key: PROFILE_PIC_S3_PATH(id),
expiresInMs: 1000 * 60 * 60 * 12, // 12 hours expiry
expiresInSecs: 1000 * 60 * 12, // 12 hours expiry
});
};
const put = async ({ id, url }: { id: UserId; url: string }) => {
const key = PROFILE_PIC_S3_PATH(id);
const res = await fetch(url);
await blobStore.put({ key, data: await res.blob() });
await blobStore.put({ key, data: await res.arrayBuffer() });
return { key };
};
const addToUser = async (user: User) => {
Expand Down
Loading

0 comments on commit dcc90cc

Please sign in to comment.