cap-js / attachments

The @cap-js/attachments package is a CDS plugin that provides out-of-the box asset storage and handling by using an aspect Attachments. It also provides a CAP-level, easy to use integration of the SAP Object Store.
Apache License 2.0
6 stars 4 forks source link

Error - Region is missing #42

Closed AjitKP91 closed 2 months ago

AjitKP91 commented 3 months ago

Getting Error:

image

Change in Code - This Works

  async updateContentHandler(req, next) {
    if (req._path.endsWith("content")) {
      const response = await SELECT.from(req.target, { ID: req.data.ID }).columns("url");
      if (response?.url) {
        const Key = response.url;
        const input = {
          Bucket: this.bucket,
          Key,
          Body: req.data.content,
          Region: this.options.credentials.region
        };
        const multipartUpload = new Upload({
          // client: new S3Client({}),
          **client: this.client,**
          params: input,
        });
        // TODO: add malware scan
        // const stored = super.put (Attachments, metadata)
        await Promise.all([multipartUpload.done()]);
      }
    } else {
      next();
    }
  }
RamIndia commented 3 months ago

@AjitKP91 Thanks for reporting the issue! here is the PR : https://github.com/cap-js/attachments/pull/43/files