Trying to deploy strapi v4 to render.com with postgres database. It’s deploying but on start it’s failing with this error
error: Middleware “strapi::session”: App keys are required. Please set app.keys in config/server.js (ex: keys: [‘myKeyA’, ‘myKeyB’])
What? Very poor explanation in docs. v3 was working just fine, should I just use that?
as error says you need to add “App keys” in config/server.js
but i would make config/env/production/server.js
and then in it add something like this. As you will need or server automatically adds NODE_ENV=production
and for “App keys” you need to add 2 random strings (16 character long) env variable when deploying in my case A9_APP_KEYS= xyxyxyxyxyxyxyxy, yxyxyxyxyxyxyxyx
my server.js:
module.exports = ({ env }) => ({
host: env('HOST', process.env.A4_HOST),
port: env.int('PORT', process.env.A5_PORT),
cron: {
enabled: true,
tasks: cronTasks,
},
url: env('APP_URL'),
proxy: true,
app: {
keys: env.array('A9_APP_KEYS')
}
});
but i would suggest you to move hosting to Railway as its cheaper, and you get 5$ free per month or 10$ if you verify with card. Im currently hosting there with postgres database and im estimated spending is 3$