I have a problem regarding deployement of my strapi project.I'm using Render to host it. I can get the homepage saying the production is successfull like in the image below
However, when I go to /admin, I get this:And If i try to get data from a url that I previously set up, i get this:
I initially was hosting on heroku, but I switched to Render. I thing the data paths dont work because they probably got permissions reset, as I had to create another db in Render to connect it.
I should also not that the git repo linked is shared between a website and strapi.Project Tree:
Portfolio: frontend: .... strapi: my-portfolio: normal strapi project structure render.yaml
So this is what my render.yaml looks like : (db is named portfolio)
previewsEnabled: trueservices: - type: web name: strapi env: node plan: starter buildCommand: cd strapi/my-portfolio && npm install && npm build startCommand: cd strapi/my-portfolio && npm start healthCheckPath: /_health envVars: - key: NODE_VERSION value: 12.18.4 - key: NODE_ENV value: production - key: CLOUDINARY_NAME sync: false - key: CLOUDINARY_KEY sync: false - key: CLOUDINARY_SECRET sync: false - key: DATABASE_URL fromDatabase: name: portfolio property: connectionString - key: JWT_SECRET generateValue: true - key: ADMIN_JWT_SECRET generateValue: truedatabases: - name: portfolio plan: starter
config/env/production/database.js:
const parse = require('pg-connection-string').parse;const config = parse(process.env.DATABASE_URL);module.exports = ({ env }) => ({ defaultConnection: 'default', connections: { default: { connector: 'bookshelf', settings: { client: 'postgres', host: config.host, port: config.port || process.env.DATABASE_PORT, database: config.database, username: config.user, password: config.password, ssl: { rejectUnauthorized: false, }, }, options: { ssl: true, }, }, },});
config/env/production/server.js:
module.exports = ({ env }) => ({ host: env('RENDER_EXTERNAL_HOSTNAME ', '0.0.0.0'), port: env.int('PORT', '1337'), url: env("MY_URL"), admin: { auth: { secret: env("ADMIN_JWT_SECRET"), }, }, });
and plugins.js has cloudinary stuff which i think is irrelevant here.
All the env are defined via render interface. I should note that process.env.DATABASE_PORT is created manually since config.port
is null, and I set it to the port of the database.
Thanks in advance.