commit bb933cc breaks adapter for me
acinader opened this issue · comments
Arthur Cinader commented
git bisect shows that this commit breaks the adapter for me: bb933cc
@dpoetzsch not sure what the commit is supposed to do or why my config would break it.
Here's my config for the adapter...
s3AdapterOptions: {
bucket: 'mybucket',
bucketPrefix: 'path/',
directAccess: true,
baseUrl: 'https://my.cloudfront.dist',
globalCacheControl: 'public, max-age=31536000',
}),
{ XMLParserError: Unexpected close tag
Line: 3
Column: 7
Char: >
at error (/Users/arthur/code/parse-server-s3-adapter/node_modules/sax/lib/sax.js:666:10)
at strictFail (/Users/arthur/code/parse-server-s3-adapter/node_modules/sax/lib/sax.js:692:7)
at closeTag (/Users/arthur/code/parse-server-s3-adapter/node_modules/sax/lib/sax.js:885:9)
at Object.write (/Users/arthur/code/parse-server-s3-adapter/node_modules/sax/lib/sax.js:1444:13)
at Parser.exports.Parser.Parser.parseString (/Users/arthur/code/parse-server-s3-adapter/node_modules/xml2js/lib/xml2js.js:502:31)
at Parser.bind [as parseString] (/Users/arthur/code/parse-server-s3-adapter/node_modules/xml2js/lib/xml2js.js:7:59)
at NodeXmlParser.parse (/Users/arthur/code/parse-server-s3-adapter/node_modules/aws-sdk/lib/xml/node_parser.js:30:10)
at Request.extractError (/Users/arthur/code/parse-server-s3-adapter/node_modules/aws-sdk/lib/services/s3.js:524:39)
at Request.callListeners (/Users/arthur/code/parse-server-s3-adapter/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (/Users/arthur/code/parse-server-s3-adapter/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
message: 'Unexpected close tag\nLine: 3\nColumn: 7\nChar: >',
code: 'XMLParserError',
retryable: true,
time: 2016-12-06T19:06:31.241Z,
originalError:
{ message: 'Unexpected close tag\nLine: 3\nColumn: 7\nChar: >',
code: 'XMLParserError',
retryable: true,
time: 2016-12-06T19:06:31.239Z },
statusCode: 403 }
Arthur Cinader commented
It looks to me that this commit should be reverted.
The problem here is that you can't assume that baseUrl is the endpoint. May work if you're using an s3 website, but if you front end with cloud front, then it breaks.
The good news is that I think you can effect what you want without a code change.
const s3OverrideOptions = {
endpoint: 'foo',
s3BucketEndpoint: true
}
new S3Adapter(adapterOptions, s3OverrideOptions);