Capella - Save Attachments (SyncGateway/CB SDK)

Hi,

I’m unable to save attachment through AppServices when connected to Capella - Request response is 403 Forbidden. GET is working as expected.
It is throwing 403 Forbidden error whenever I’m trying to add binary to body in PUT request.

Same code working fine with SyncGateway 2.8

Please help!!
TIA

Hi Michael,

Here is the code I’m using

var request = require(‘request’);
var options = {
‘method’: ‘PUT’,
‘url’: ‘https://{{SG_URL}}/{{DB_NAME}}/{{DOC_ID}}/{{FILE_NAME}}/{{REV_ID}}’,
‘headers’: {
‘Content-Type’: ‘image/png’,
‘Authorization’: ‘Basic XXXXXXXXXXXXXXXXX’
},
body: “{{BINARY}}”

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Edit: Before looking into other things, ensure that your AWS WAF rule allows request bodies of at least the size of the document. Otherwise you’ll get 403.

Same code working fine with SyncGateway 2.8

And what is it not working with?

Request response is 403 Forbidden. GET is working as expected.

Does the user have permission to write to the bucket (DB_NAME)?

if (error) throw new Error(error);
console.log(response.body);
});

And what is response.body? What is error?

Sometimes it’s easier to figure out the diagnostic with “curl -v …”

If you have an Enterprise license, you can open an issue at support.couchbase.com

And what is it not working with?

It is Capella AppServices

After several tests, identified that the attachment is being saved if the file size is less than 5kb.

Is it because we are using a trial account? Are there any document size limits for trial accounts?

identified that the attachment is being saved if the file size is less than 5kb.

It’s an AWS WAF limit. See my post above about overriding the SizeRestrictions_Body

I believe we identified an issue on our end, correct @priya.rajagopal ?

It is resolved by Couchbase team (Updated AWS size rules in AWS)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.