Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mongodb 缝合服务错误 &引用;aws:“;aws“U服务”;是必需的字符串“;,errorCodeName:InvalidParameter_Mongodb_Amazon Web Services_Amazon S3_Mongodb Atlas_Mongodb Stitch - Fatal编程技术网

Mongodb 缝合服务错误 &引用;aws:“;aws“U服务”;是必需的字符串“;,errorCodeName:InvalidParameter

Mongodb 缝合服务错误 &引用;aws:“;aws“U服务”;是必需的字符串“;,errorCodeName:InvalidParameter,mongodb,amazon-web-services,amazon-s3,mongodb-atlas,mongodb-stitch,Mongodb,Amazon Web Services,Amazon S3,Mongodb Atlas,Mongodb Stitch,我正在设置AWS S3 bucket,以便使用MongoDB Stitch将音频文件上载到(以下是文档。在遵循说明并验证我的用户后,在尝试上载所选文件时,我不断遇到此错误: 在第119行,错误来自哪里,我只是在运行AWS build之后捕捉到错误: const aws = stitchClient.getServiceClient(AwsServiceClient.factory, "AWS"); convertAudioToBSONBinaryObject(file).then((resul

我正在设置AWS S3 bucket,以便使用MongoDB Stitch将音频文件上载到(以下是文档。在遵循说明并验证我的用户后,在尝试上载所选文件时,我不断遇到此错误:

在第119行,错误来自哪里,我只是在运行AWS build之后捕捉到错误:

const aws = stitchClient.getServiceClient(AwsServiceClient.factory, "AWS");

convertAudioToBSONBinaryObject(file).then((result) => {
  const audiofile = mongodb.db("data").collection("audiofile");
  //now we need an instance of AWS service client
  const key = `${stitchClient.auth.user.id}-${file.name}`;
  // const key = `${stitchClient.auth.user.id}-${file.name}`;
  const bucket = "myBucketName";
  const url =
    "http://" + bucket + ".s3.amazonaws.com/" + encodeURIComponent(key);

  const args = {
    ACL: "public-read",
    Bucket: bucket,
    ContentType: file.type,
    Key: key,
    Body: result,
    // aws_service: "s3",
  };
  // building the request
  const request = new AwsRequest.Builder()
    .withService("s3")
    .withAction("PutObject")
    .withRegion("us-east-1")
    .withArgs(args);

  aws
    .execute(request.build)
    .then((result) => {
      console.log(result);
      console.log(url);
      return audiofile.insertOne({
        owner_id: stitchClient.auth.user.id,
        url,
        file: {
          name: file.name,
          type: file.type,
        },
        Etag: result.Etag,
        ts: new Date(),
      });
    })
    .then((result) => {
      console.log("last result", result);
    })
    .catch((err) => {
      console.log(err);
    });
});
s3的缝合规则如下所示:

因此,在我看来,一切都是按照它所指定的方式设置的,但是错误告诉我,我没有传递所有需要的参数。我真的很感激任何关于如何修复此错误的想法

注意:如果我将此行中的“AWS”改为“AWS_S3”:
const aws=stitchClient.getServiceClient(AwsServiceClient.factory,“aws”);
错误消息更改为:

StitchServiceError{消息:“未找到服务:'AWS_S3'”,名称:“StitchServiceError”,错误代码:18,错误代码名称:“ServiceNotFound”


登录缝合显示了这两个错误的信息:

这一行的答案很简单:

aws
.execute(request.build)
。然后((结果)

build是一个函数,所以我只需要调用它-(request.build())。然后((result)。 问题解决了,谢谢大家