Next.js Discord

Discord Forum

How do I whitelist a domain to be able to display images?

Unanswered
Black carpenter ant posted this in #help-forum
Open in Discord
Black carpenter antOP
Hi guys, I am trying to whitelist this domain so I can pull images from it but the images are not showing up. Could you please advise how to whitelist domains to be able to pull images?

thanks!

This is what is inside of my config:

/** @type {import('next').NextConfig} */
const nextConfig = {
images : {
domains: ['https://i.pravatar.cc']
}
}

module.exports = nextConfig

3 Replies

Golden-winged Warbler
Hard to know without seeing the error for why it is not loading. One thing that comes to mind is Content Security Policy (CSP)
Black carpenter antOP
node:events:490
throw er; // Unhandled 'error' event
^

Error: EPERM: operation not permitted, open 'C:\Users\alexa\Desktop\TicketingSystem\my-app.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\alexa\Desktop\TicketingSystem\my-app\.next\trace'
}


That is the error I get when I save that config file.
Doesn't look like an error related to loading images to me.