Skip to content

Commit 8ac6014

Browse files
authored
feat: Migrate S3 Client from AWS SDK v2 to v3 (#231)
BREAKING CHANGE: The AWS S3 credentials are now set under `s3overrides.credentials` instead of directly under the `s3overrides` key; see the [migration guide](https://github.com/parse-community/parse-server-s3-adapter?#migration-guide-from-3x-to-4x) for more details.
1 parent 1f74921 commit 8ac6014

14 files changed

+6277
-3296
lines changed

.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
"globals": {
2929
"Parse": true
3030
}
31-
}
31+
}

.github/workflows/ci.yml

-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ jobs:
3434
- name: Parse Server 7, Node.js 22
3535
NODE_VERSION: 22.4.1
3636
PARSE_SERVER_VERSION: 7
37-
- name: Parse Server 6
38-
NODE_VERSION: 18
39-
PARSE_SERVER_VERSION: 6
4037
fail-fast: false
4138
name: ${{ matrix.name }}
4239
timeout-minutes: 15

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,4 @@ ___
177177

178178

179179

180-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
180+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

README.md

+76-13
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
[![Coverage](https://img.shields.io/codecov/c/github/parse-community/parse-server-s3-adapter/master.svg)](https://codecov.io/github/parse-community/parse-server-s3-adapter?branch=master)
66
[![auto-release](https://img.shields.io/badge/%F0%9F%9A%80-auto--release-9e34eb.svg)](https://github.com/parse-community/parse-server-s3-adapter/releases)
77

8+
[![Parse Server](https://img.shields.io/badge/Parse_Server-7.0-169CEE.svg?style=flat&logo=data:image/svg%2bxml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGlkPSJ1dWlkLTg2MzQ2MDY1LTNjNjQtNDBlYy1hNmQ0L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ODguOTYtNjQuMjcsMTQyLjM5LTgwLjcxLDMwLjU1LTkuNCw2MS43NC0xNS4zNSw5My41My0xNy42NSw4MC4yMS01Ljc5LDE1Ny4wNSw2Ljg1LDIyOC42LDQ0Ljg3LDYzLjExLDMzLjU0LDExMi4wMSw4MS44OCwxNDYuNTUsMTQ0LjU1LDI0LjczLDQ0Ljg3LDM5LjE3LDkyLjk2LDQ1LjU3LDE0My43MSwzLjcxLDI5LjM4LDQuMjIsNTguODcsMi4yOSw4OC4yMS00LjU0LDY5LjI2LTI1LjQxLDEzMy4zOS02NC41LDE5MS4xMS0zNS41MSw1Mi40Mi04MS43Miw5Mi44OC0xMzcuNjgsMTIyLjM4LTQ1LjQ5LDIzLjk4LTkzLjg4LDM4LjY1LTE0NC43NSw0NS4zNC0xOS4zOCwyLjU1LTM4Ljg3LDMuNzQtNTguNDYsMy43LTc0LjA1LS4xNi0xNDguMS0uMDYtMjIyLjE0LS4wNloiIHN0eWxlPSJmaWxsOiNlMGUwZTA7Ii8+PC9nPjwvc3ZnPg==)](https://github.com/parse-community/parse-server/releases)
9+
[![Node Version](https://img.shields.io/badge/nodejs-18,_20,_22-green.svg?logo=node.js&style=flat)](https://nodejs.org)
10+
811
[![npm latest version](https://img.shields.io/npm/v/@parse/s3-files-adapter.svg)](https://www.npmjs.com/package/@parse/s3-files-adapter)
912

1013
---
@@ -28,6 +31,7 @@ The official AWS S3 file storage adapter for Parse Server. See [Parse Server S3
2831
- [Adding Metadata and Tags](#adding-metadata-and-tags)
2932
- [Compatibility with other Storage Providers](#compatibility-with-other-storage-providers)
3033
- [Digital Ocean Spaces](#digital-ocean-spaces)
34+
- [Migration Guide from 3.x to 4.x](#migration-guide-from-3x-to-4x)
3135

3236

3337
# Getting Started
@@ -40,21 +44,24 @@ The official AWS S3 file storage adapter for Parse Server. See [Parse Server S3
4044

4145
### Parse Server
4246

43-
| Version | End-of-Life | Compatible |
44-
|---------|---------------|------------|
45-
| <=5 | December 2023 | ✅ Yes |
46-
| 6 | December 2024 | ✅ Yes |
47-
| 7 | December 2025 | ✅ Yes |
47+
Parse Server S3 Adapter is compatible with the following versions of Parse Server.
48+
49+
| Parse Server Version | End-of-Life | Compatible |
50+
|----------------------|---------------|------------|
51+
| <=5 | December 2023 | ❌ No |
52+
| 6 | December 2024 | ❌ No |
53+
| <7.3.0 | December 2025 | ❌ No |
54+
| >=7.3.0 | December 2025 | ✅ Yes |
4855

4956
### Node.js
5057

51-
This product is continuously tested with the most recent releases of Node.js to ensure compatibility. We follow the [Node.js Long Term Support plan](https://github.com/nodejs/Release) and only test against versions that are officially supported and have not reached their end-of-life date.
58+
Parse Server S3 Adapter is continuously tested with the most recent releases of Node.js to ensure compatibility. We follow the [Node.js Long Term Support plan](https://github.com/nodejs/Release) and only test against versions that are officially supported and have not reached their end-of-life date.
5259

53-
| Version | Latest Version | End-of-Life | Compatible |
54-
|------------|----------------|-------------|------------|
55-
| Node.js 18 | 18.20.4 | April 2025 | ✅ Yes |
56-
| Node.js 20 | 20.15.1 | April 2026 | ✅ Yes |
57-
| Node.js 22 | 22.4.1 | April 2027 | ✅ Yes |
60+
| Node.js Version | End-of-Life | Compatible |
61+
|-----------------|-------------|------------|
62+
| 18 | April 2025 | ✅ Yes |
63+
| 20 | April 2026 | ✅ Yes |
64+
| 22 | April 2027 | ✅ Yes |
5865

5966
## AWS Credentials
6067

@@ -277,7 +284,6 @@ var S3Adapter = require("@parse/s3-files-adapter");
277284
var AWS = require("aws-sdk");
278285

279286
//Configure Digital Ocean Spaces EndPoint
280-
const spacesEndpoint = new AWS.Endpoint(process.env.SPACES_ENDPOINT);
281287
var s3Options = {
282288
bucket: process.env.SPACES_BUCKET_NAME,
283289
baseUrl: process.env.SPACES_BASE_URL,
@@ -290,7 +296,7 @@ var s3Options = {
290296
s3overrides: {
291297
accessKeyId: process.env.SPACES_ACCESS_KEY,
292298
secretAccessKey: process.env.SPACES_SECRET_KEY,
293-
endpoint: spacesEndpoint
299+
endpoint: process.env.SPACES_ENDPOINT
294300
}
295301
};
296302

@@ -307,3 +313,60 @@ var api = new ParseServer({
307313
filesAdapter: s3Adapter
308314
});
309315
```
316+
317+
318+
# Migration Guide from 3.x to 4.x
319+
320+
Due to the deprecation of the AWS SDK v2, Parse Server S3 Adapter 4.x adopts the AWS SDK v3. When upgrading from Parse Server S3 Adapter 3.x to 4.x, consider that S3 credentials are passed differently:
321+
322+
*Parse Server S3 Adapter 3.x:*
323+
324+
```js
325+
const options = {
326+
bucket: '<AWS_S3_BUCKET>',
327+
s3overrides: {
328+
accessKeyId: '<AWS_ACCESS_KEY>',
329+
secretAccessKey: '<AWS_SECRET_KEY>'
330+
}
331+
};
332+
```
333+
334+
*Parse Server S3 Adapter 4.x:*
335+
336+
```js
337+
const options = {
338+
bucket: '<AWS_S3_BUCKET>',
339+
s3overrides: {
340+
credentials: {
341+
accessKeyId: '<AWS_ACCESS_KEY>',
342+
secretAccessKey: '<AWS_SECRET_KEY>'
343+
}
344+
}
345+
};
346+
```
347+
348+
Alternatively, the credentials can be set on the root object:
349+
350+
```js
351+
const options = {
352+
bucket: '<AWS_S3_BUCKET>',
353+
credentials: {
354+
accessKeyId: '<AWS_ACCESS_KEY>',
355+
secretAccessKey: '<AWS_SECRET_KEY>'
356+
}
357+
};
358+
```
359+
360+
> [!NOTE]
361+
> It is best practice to not store credentials as environment variables, as they can be easily retrieved on a compromised machine. For Parse Server running in an AWS environment, use more secure alternatives like AWS Secrets Manager, or AWS Credential Identity Provider to access shared credentials:
362+
>
363+
> ```js
364+
> import { fromIni } from 'aws-sdk/credential-providers';
365+
>
366+
> const options = {
367+
> bucket: '<AWS_S3_BUCKET>',
368+
> s3overrides: {
369+
> credentials: fromIni({ profile: '<AWS_CLIENT_PROFILE>' })
370+
> }
371+
> };
372+
> ```

0 commit comments

Comments
 (0)