Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration guide from strapi-provider-upload-aws-s3-advanced to aws-s3 #31

Open
hevar opened this issue Apr 22, 2024 · 2 comments
Open

Comments

@hevar
Copy link

hevar commented Apr 22, 2024

As stated in the docs this project is no longer maintained and the strapi s3 provider is recomended https://market.strapi.io/providers/@strapi-provider-upload-aws-s3.

I've been using this project (thanks btw!) since I used a CDN in front of my S3 bucket and would now like to migrate back.

I'm a bit worried of the migration back, since I don't want to break all my upload and their urls. It's quite a lot of uploads.

I remember that when I migrated to this project the below query was necessary. I guess he opposite would be needed now?

UPDATE files SET formats = replace(formats, 'https://my-cms.s3.eu-north-1.amazonaws.com', 'https://my-cdn.mydomain.com'),
url = replace(url, 'https://my-cms.s3.eu-north-1.amazonaws.com', 'https://my-cdn.mydomain.com'),
provider = replace(provider, 'aws-s3', 'strapi-provider-upload-aws-s3-advanced')

Appreciate the work you guys have done, and thanks in advance.

@zoomoid
Copy link
Owner

zoomoid commented May 13, 2024

Hey, sorry I'm only now getting to this, yeah, scrolling through #25 and all the proposed SQL queries there, the above looks good, but I'd check if the URL and format columns still look the same, it's been a while :)

@hevar
Copy link
Author

hevar commented May 13, 2024

@zoomoid No worries! Can also share how I migrated which was simpler than I initially thought.

For future reference

Migration back to @strapi/provider-upload-aws-s3

// package.json
"dependencies": {
    // ...
    "strapi-provider-upload-aws-s3-advanced": "^5.0.1"
  },

to:

// package.json
"dependencies": {
    // ...
    "@strapi/provider-upload-aws-s3": "^4.23.1",
  },

And

// plugins.js
module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: "strapi-provider-upload-aws-s3-advanced",
      providerOptions: {
        accessKeyId: env("AWS_ACCESS_KEY_ID"),
        secretAccessKey: env("AWS_ACCESS_SECRET"),
        region: env("AWS_REGION"),
        params: {
          bucket: env("AWS_BUCKET"),
        },
        baseUrl: env("AWS_CDN_BASE_URL"),
      },
      breakpoints: {
        xlarge: 1920,
        large: 1028,
        medium: 512,
        small: 256,
        xsmall: 128,
        "2xsmall": 64,
      },
    },
  },

});

to:

module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: "aws-s3",
      providerOptions: {
        baseUrl: env("AWS_CDN_BASE_URL"),
        s3Options: {
          credentials: {
            accessKeyId: env("AWS_ACCESS_KEY_ID"),
            secretAccessKey: env("AWS_ACCESS_SECRET"),
          },
          region: env("AWS_REGION"),
          params: {
            Bucket: env("AWS_BUCKET"),
          },
        },
      },
      breakpoints: {
        xlarge: 1920,
        large: 1028,
        medium: 512,
        small: 256,
        xsmall: 128,
        "2xsmall": 64,
      },
    },
  },

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants