如何解决AWS SDK 3 WriteGetObjectResponseCommand 问题
在我当前的项目中,我们正在尝试迁移到 AWS 开发工具包版本 3 (Javascript)。我们正在使用 s3 对象 lambdas,并且遇到了 byte[] images = null;
FileStream fileStream = new FileStream(imagelocation,FileMode.Open,FileAccess.Read);
BinaryReader binaryReader = new BinaryReader(fileStream);
images = binaryReader.ReadBytes((int)fileStream.Length);
Dbclass dbclass = new Dbclass();
string maincon = ConfigurationManager.ConnectionStrings["connection"].ConnectionString;
sqlConnection sqlcon = new sqlConnection(maincon);
sqlcon.open();
string query = "insert into Categories(CategoryName,Description,Picture) Values ('" + texBoxcatname.Text + "','" + textBoxcatdesc.Text + "',@images)";
sqlCommand sqlCommand = new sqlCommand(query,sqlcon);
sqlCommand.Parameters.Add(new sqlParameter("@images",images));
int N = sqlCommand.ExecuteNonQuery();
sqlcon.Close();
MessageBox.Show("saved");
命令的问题。
WriteGetobjectResponseCommand
代码:
WriteGetobjectResponseCommand
与聚合客户端相同的问题:
import { S3Client,S3 } from '@aws-sdk/client-s3';
const s3Client = new S3Client({});
async function passtransformedPhoto(
body: Buffer,outputRoute: string,outputToken: string,): Promise<WriteGetobjectResponseCommandOutput> {
try {
const writeGetobjectParams: WriteGetobjectResponseCommandInput = {
RequestRoute: outputRoute,RequestToken: outputToken,Body: body,};
const command = new WriteGetobjectResponseCommand(writeGetobjectParams);
return s3Client.send(command);
} catch (e) {
console.log('Error happens in passtransformedPhoto',e);
}
错误:
import { S3Client,S3 } from '@aws-sdk/client-s3';
const s3Aggregated = new S3({});
async function passtransformedPhoto(body: Buffer,outputToken: string) {
try {
const result = await s3Aggregated.writeGetobjectResponse({
RequestRoute: outputRoute,});
return result;
} catch (e) {
console.log('Error happens in passtransformedPhoto',e);
}
}
环境:
INFO TypeError: Cannot destructure property 'service' of 'bucketName' as it is undefined.
at getEndpointFromArn (/var/task/node_modules/@aws-sdk/middleware-bucket-endpoint/dist/cjs/bucketHostname.js:26:13)
at Object.bucketHostname (/var/task/node_modules/@aws-sdk/middleware-bucket-endpoint/dist/cjs/bucketHostname.js:17:13)
at /var/task/node_modules/@aws-sdk/middleware-bucket-endpoint/dist/cjs/bucketEndpointMiddleware.js:47:67
at processticksAndRejections (internal/process/task_queues.js:95:5)
非常感谢您对此问题的任何帮助或澄清。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。