Help with S3 storage and CDN

System Information
  • Strapi Version: 3.0.0-beta.17.5
  • Operating System: Windows 10
  • Database: PostgreSQL 13
  • Node Version: v14.16.1.
  • NPM Version: 6.14.12
  • Yarn Version: NA

Hello everyone, I am in need of some help. I have been asked to enable CDN for assets uploaded to Strapi. When the link to the asset is visited, they want the CDN link to be used instead. I am reading the documentation here: Upload - Strapi Developer Documentation and I have seen this package: strapi-provider-upload-aws-s3-plus-cdn - npm
but I am new to Strapi and could use some hand holding to get started. If anybody would be kind enough to help the new guy out I would really appreciate it. It is my 2nd day at my very first job as a web developer. I’m starting to get major imposter syndrome trying to figure out where to start and all the things I will need to do to get this working. I am also new to Strapi so if anybody would be willing to explain it like I’m a complete beginner, I am. I am testing locally on my Windows 10 machine but the server the client is using is nginx/1.15.6. Thanks again.

Hi @shwackd,

First of all don’t worry you are in the best place to find help :wink:

Did you set your CDN_URL in the configuration of the plugin you’re using ?

Here the configuration:


module.exports = ({ env }) => ({
  // ...
  upload: {
    provider: 'aws-s3-plus-cdn',
    providerOptions: {
      accessKeyId: env('AWS_ACCESS_KEY_ID'),
      secretAccessKey: env('AWS_ACCESS_SECRET'),
      region: env('AWS_REGION'),
      params: {
        Bucket: env('AWS_BUCKET'),
      cdnUrl: env("CDN_URL"), // Optional CDN URL - include protofol and trailing forward slash, e.g. ''
  // ...

As said in the plugin’s note:

Strapi will use the configured S3 bucket for upload and delete operations, but writes the CDN url (if configured) into the database record.

N.B: Don’t worry about the impostor syndrome you are the best! :wink:


Thank you @Stun3R I really appreciate your response and encouragement. I will be trying to add the CDN URL on this all next week and will update you with my progress. I would also like to use our personal domain like the example: instead of the CDN url and I think I will need to edit DNS configuration for that. Right now I’m just trying to wrap my head around everything before I start trying things without a plan.

1 Like

Hey Stun3R,
I have been trying for hours to get this plugin working, and I have everything filled out, but every time I create the file at ./config/plugins.js I get error: “Cannot read property ‘defaultConnection’ of undefined”
When the file at ./config/plugins.js is blank, everything works, but as soon as I add anything in it, even a blank module.exports = () => ({}) I get the error. The Strapi I am working with is 3.0.0-beta.17.5.


Oh I see, you should migrate to the latest version since Strapi is no longer in beta :wink: It will help using the plugins correctly

I will request, but unfortunately this is a project I am not in control of so I can only ask. I see they already have aws-s3-with-custom-domain plugin installed, but I cannot see where they set it up.

The configuration of plugins changed between the beta and the release so it will be difficult for you unfortunately

Thank you for letting me know this it really helps. I will let my client know and see what they would like to do.

1 Like

Edit: I got it working - It seems I needed to get rid of node_modules and npm install again. Now on to the next task.

Hey @Stun3R , this is turning out to be quite the task. I am following Migrate to beta.18 - Strapi Developer Documentation which is to be one of many guides I will need to follow to get to the current version. I have followed all steps and when I run ‘npm run develop’ I am running into this error:
error TypeError: Cannot convert undefined or null to object
at Function.values ()
at Object.load (C:\Users\mainuser\files\web\strapi\strapiproject\test-project\node_modules\strapi-database\lib\connector-registry.js:17:39)

Edit: I’ve commented out the ssl options in database.js for now. The server starts with npm run develop but now I only receive this from the browser: {“statusCode”:404,“error”:“Not Found”,“message”:“Not Found”} No urls work anymore. I have been at this for hours and am exhausted. Every upgrade worked except this last one this is so frustrating!

I’ve gotten all upgrades done successfully but on the final move to 3.0.0 I am stuck at error Error: The server does not support SSL connections

I’ve fixed everything so far and I found the problem. The language settings in middleware. If I set language : { enabled: true} everything breaks. When it set it to false it works again. I have no idea why or how important it is to my client. I will have to ask.

Hey @Stun3R, I have a new problem when upgrading from 3.1.7 to 3.2.3. After following all instructions I get this error when running npm develop:
error Bootstrap function in plugin “users-permissions” failed
[2021-05-12T02:09:56.179Z] error error: update “users-permissions_permission” set “role” = $1, “created_by” = $2, “updated_by” = $3 where “id” = $4 returning * - column
“created_by” of relation “users-permissions_permission” does not exist

Unfortunately searching for this on Google returns nothing and I am at a standstill.

For the SSL error here some informations: fix(configurations): fix ssl configuration for postgres by Stun3R · Pull Request #282 · strapi/documentation · GitHub</
You have to set the ssl object it to false

Did you clean cache & rebuild your admin panel after each update ?

Hi @Stun3R,

I commented out the ssl code and it worked, and yes I delete and rebuild .cache, build, node_modules, and package-lock.json every upate. I was able to get the desired plugin working on 3.1.7 so my client has started another project for Strapi. Maybe this will be a new install, I’m not sure yet. I really appreciate all the support from you! I’ll keep you posted in this thread how things go.

Hi @shwackd,

I’m happy to hear that :wink:
Good luck for your project !!