fix: consume blob stream correctly (#5706)

- use correctly endpoint in r2
- consume blob stream correctly
This commit is contained in:
DarkSky 2024-01-25 10:59:53 +00:00
parent db3891ba33
commit fdffe90892
No known key found for this signature in database
GPG Key ID: 97B7D036B1566E9D
5 changed files with 743 additions and 740 deletions

View File

@ -20,7 +20,7 @@
"dependencies": { "dependencies": {
"@apollo/server": "^4.9.5", "@apollo/server": "^4.9.5",
"@auth/prisma-adapter": "^1.0.7", "@auth/prisma-adapter": "^1.0.7",
"@aws-sdk/client-s3": "^3.454.0", "@aws-sdk/client-s3": "^3.499.0",
"@google-cloud/opentelemetry-cloud-monitoring-exporter": "^0.17.0", "@google-cloud/opentelemetry-cloud-monitoring-exporter": "^0.17.0",
"@google-cloud/opentelemetry-cloud-trace-exporter": "^2.1.0", "@google-cloud/opentelemetry-cloud-trace-exporter": "^2.1.0",
"@google-cloud/opentelemetry-resource-util": "^2.1.0", "@google-cloud/opentelemetry-resource-util": "^2.1.0",

View File

@ -10,6 +10,7 @@ export class R2StorageProvider extends S3StorageProvider {
super( super(
{ {
...config, ...config,
forcePathStyle: true,
endpoint: `https://${config.accountId}.r2.cloudflarestorage.com`, endpoint: `https://${config.accountId}.r2.cloudflarestorage.com`,
}, },
bucket bucket

View File

@ -49,7 +49,7 @@ export class S3StorageProvider implements StorageProvider {
new PutObjectCommand({ new PutObjectCommand({
Bucket: this.bucket, Bucket: this.bucket,
Key: key, Key: key,
Body: body, Body: blob,
// metadata // metadata
ContentType: metadata.contentType, ContentType: metadata.contentType,

View File

@ -94,7 +94,7 @@
"zod": "^3.22.4" "zod": "^3.22.4"
}, },
"devDependencies": { "devDependencies": {
"@aws-sdk/client-s3": "3.485.0", "@aws-sdk/client-s3": "3.499.0",
"@perfsee/webpack": "^1.10.0", "@perfsee/webpack": "^1.10.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
"@sentry/webpack-plugin": "^2.8.0", "@sentry/webpack-plugin": "^2.8.0",

1476
yarn.lock

File diff suppressed because it is too large Load Diff