parse-server-s3-adapter
parse-server-s3-adapter copied to clipboard
Adapter does't work with ap-east-1 (HK)
There is the issue with adapter: if I'm using with it ap-east-1 (HK) region - I can upload image without problems, however when I get wrong URL to access it.
The url does not specify region. Perfectly works with other regions
Thanks for reporting.
We need more details to analyze this. Can you give example results for working and non-working regions, to clearly describe what difference you are observing and why it is not working?
This is example of URL I get when I'm uploading files to ap-east-1:
https://impacked-bucket.s3.amazonaws.com/ae4f9b42e88d85f09dec2d9ebbacb047_download.jpeg
But correct URL should be:
https://impacked-bucket.s3.ap-east-1.amazonaws.com/ae4f9b42e88d85f09dec2d9ebbacb047_download.jpeg
Can you please also share your S3 adapter configuration?
Yes, of course
var s3Adapter = new S3Adapter( process.env.AWS_ACCESS_KEY, process.env.AWS_SECRET_KEY, process.env.S3_BUCKET_NAME, { region: process.env.S3_REGION, directAccess: true, signatureVersion: 'v4', }, );
How do you use the adapter in the context of Parse Server? Is the S3 adapter configuration not part of your Parse Server configuration?
filesAdapter: {
module: "@parse/s3-files-adapter",
options: {
bucket: ...,
region: ...,
bucketPrefix: ...,
baseUrl: ...,
signatureVersion: "v4",
}
},
This is how it is:
var s3Adapter = new S3Adapter( process.env.AWS_ACCESS_KEY, process.env.AWS_SECRET_KEY, process.env.S3_BUCKET_NAME, { region: process.env.S3_REGION, directAccess: true, signatureVersion: 'v4', }, );
var api = new ParseServer({ databaseURI: databaseUri, cloud: process.env.CLOUD_CODE_MAIN, masterKey: process.env.MASTER_KEY, serverURL: process.env.SERVER_URL, filesAdapter: s3Adapter, });
I would look into whether the way you initialize makes any difference. From your code it's not clear which adapter repo you are using. Either way, I suggest you take a look at the region parameter and how the URL is composed in the adapter. I would imagine the logic to be region-agnostic, but according to your description, it works for you if you change the region, so something doesn't add up.