We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@aws-sdk/client-s3
I'm trying to use this example to integrate with the AWS S3 SDK. I keep running into this error regardless of the command that I use.
TypeError: (0 , import_slurpFile.slurpFile) is not a function
Has anyone attempted this thus far? Here is a preview of what my route looks like.
import { PutObjectCommand, S3Client, S3ServiceException, } from '@aws-sdk/client-s3'; const client = new S3Client({ region: 'us-east-1', credentials: { accessKeyId: 'random-key', secretAccessKey: 'random-secret', }, }); export async function POST(req: Request) { const formData = await req.formData(); for (const key of formData.keys()) { if (key.startsWith('photo')) { const file = formData.get(key); if (file && typeof file === 'object') { console.log('file', file.name, file.size); const buffer = Buffer.from(await file.arrayBuffer()); console.log('buffer', buffer); const command = new PutObjectCommand({ Bucket: 'development', Key: `media/${file.name ?? 'photo.png'}`, // Use the file name as the key Body: buffer, }); try { console.log('getting ready to upload'); const response = await client.send(command); console.log(response); } catch (caught) { if (caught instanceof S3ServiceException) { console.error( `Error from S3 while uploading object to development. ${caught.name}: ${caught.message}`, ); } else { throw caught; } } } } } return Response.json({ success: true }); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm trying to use this example to integrate with the AWS S3 SDK. I keep running into this error regardless of the command that I use.
Has anyone attempted this thus far? Here is a preview of what my route looks like.
The text was updated successfully, but these errors were encountered: