Hi All, I have two queries on next.config.js.
I am currently using Nextjs for my frontend and Strapi CMS for my backend.
Currently, my Strapi is deployed on DigitalOcean and I have created a Space to store images instead of using a database. Link as follows: https://next-cms-strapi-spaces.sgp1.digitaloceanspaces.com
My main Strapi backend is deployed on DigitalOcean and link is as follows:
https://nextjs-strapi-cms-45gnt.ondigitalocean.app
My front end is deployed on Vercel. I am still trying to figure things on using Nextjs framework and currently would like to use Image instead of img tag, therefore the next.config.js is as follows:
/** @type {import('next').NextConfig} */
module.exports = {
// output: 'export',
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'next-cms-strapi-spaces.sgp1.digitaloceanspaces.com',
port: '',
pathname: '/aa7f294677adda00fa96235a76426c01.jpg'
},
],
},
};
Qns 1:
I am currently still working on localhost and somehow when I implement the code above into next.config.js; it throws this error. I don’t seem to have a .next/trace in the folder after running npm run build
. Is there a way to fix this error?
Error msg:
Error: EPERM: operation not permitted, open 'C:\Users\Harold\OneDrive\Desktop\Course notes\next-reviews\.next\trace'
Emitted 'error' event on WriteStream instance at:
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4048,
code: 'EPERM',
syscall: 'open',
path: 'C:\\Users\\Harold\\OneDrive\\Desktop\\Course notes\\next-reviews\\.next\\trace'
}
Qns 2. One of the image url link is as follows: https://next-cms-strapi-spaces.sgp1.digitaloceanspaces.com/aa7f294677adda00fa96235a76426c01.jpg, therefore is there a way to make the pathname dynamic? I tried using //http://next-cms-strapi-spaces.sgp1.digitaloceanspaces.com/**
, would like to know whether is this the correct method?