403 error Next/images URL not on allowlist

Hi there,

I’m having problems after deployment with 403 errors on Next/images. None of the images are displaying apart from the ones already in the project file. It says URL not on allowlist.

I have set NEXT_IMAGE_ALLOWED_DOMAINS = ‘ipfs.moralis.io’ into the environment variables, however still no luck. Which is odd, seeing as I did it around two weeks ago and that seemed to work and i’m not sure what’s changed.

I can see there are a couple topics about the issue, however, none of the suggestions seem to work.

Is there a work around?

Many thanks

Hey there, @ChrisGimlore :wave:

Thanks for reaching out. I am unable to open the link that is included in your post above, which makes investigating hard. Can you please share a link to your site as well as your full deploy log? This will help us investigate further.

Thanks!

Hi Hillary,

The link is: https://main--netlify-thinks-chrisgimlore-is-great.netlify.app/

The deploy is as follows:

4:56:34 PM: Build ready to start
4:56:36 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
4:56:36 PM: build-image tag: v4.10.1
4:56:36 PM: buildbot version: f50214a1de5f04db9b59dcaff80e969673c77548
4:56:36 PM: Fetching cached dependencies
4:56:36 PM: Starting to download cache of 412.1MB
4:56:39 PM: Finished downloading cache in 3.133410142s
4:56:39 PM: Starting to extract cache
4:56:43 PM: Finished extracting cache in 3.967188504s
4:56:43 PM: Finished fetching cache in 7.174475042s
4:56:43 PM: Starting to prepare the repo for build
4:56:43 PM: Preparing Git Reference refs/heads/main
4:56:44 PM: Parsing package.json dependencies
4:56:45 PM: Starting build script
4:56:45 PM: Installing dependencies
4:56:45 PM: Python version set to 2.7
4:56:45 PM: Started restoring cached node version
4:56:46 PM: Finished restoring cached node version
4:56:46 PM: v16.15.0 is already installed.
4:56:46 PM: Now using node v16.15.0 (npm v8.5.5)
4:56:46 PM: Started restoring cached build plugins
4:56:46 PM: Finished restoring cached build plugins
4:56:46 PM: Attempting ruby version 2.7.2, read from environment
4:56:47 PM: Using ruby version 2.7.2
4:56:47 PM: Using PHP version 8.0
4:56:47 PM: No npm workspaces detected
4:56:47 PM: Started restoring cached node modules
4:56:47 PM: Finished restoring cached node modules
4:56:48 PM: Started restoring cached go cache
4:56:48 PM: Finished restoring cached go cache
4:56:48 PM: Installing Go version 1.17 (requested 1.17)
4:56:52 PM: unset GOOS;
4:56:52 PM: unset GOARCH;
4:56:52 PM: export GOROOT=‘/opt/buildhome/.gimme/versions/go1.17.linux.amd64’;
4:56:52 PM: export PATH=“/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}”;
4:56:52 PM: go version >&2;
4:56:52 PM: export GIMME_ENV=“/opt/buildhome/.gimme/env/go1.17.linux.amd64.env”
4:56:52 PM: go version go1.17 linux/amd64
4:56:52 PM: Installing missing commands
4:56:52 PM: Verify run directory
4:56:53 PM: ​
4:56:53 PM: ────────────────────────────────────────────────────────────────
4:56:53 PM: Netlify Build
4:56:53 PM: ────────────────────────────────────────────────────────────────
4:56:53 PM: ​
4:56:53 PM: ❯ Version
4:56:53 PM: @netlify/build 27.8.1
4:56:53 PM: ​
4:56:53 PM: ❯ Flags
4:56:53 PM: baseRelDir: true
4:56:53 PM: buildId: 62e9493238587626dcaf3d4a
4:56:53 PM: deployId: 62e9493238587626dcaf3d4c
4:56:53 PM: ​
4:56:53 PM: ❯ Current directory
4:56:53 PM: /opt/build/repo
4:56:53 PM: ​
4:56:53 PM: ❯ Config file
4:56:53 PM: No config file was defined: using default values.
4:56:53 PM: ​
4:56:53 PM: ❯ Context
4:56:53 PM: production
4:56:53 PM: ​
4:56:53 PM: ❯ Loading plugins
4:56:53 PM: - @netlify/plugin-nextjs@4.13.0 from Netlify app and package.json
4:56:54 PM: ​
4:56:54 PM: ────────────────────────────────────────────────────────────────
4:56:54 PM: 1. @netlify/plugin-nextjs (onPreBuild event)
4:56:54 PM: ────────────────────────────────────────────────────────────────
4:56:54 PM: ​
4:56:54 PM: Next.js cache restored.
4:56:54 PM: Netlify configuration property “build.environment.NEXT_PRIVATE_TARGET” value changed.
4:56:54 PM: ​
4:56:54 PM: (@netlify/plugin-nextjs onPreBuild completed in 329ms)
4:56:54 PM: ​
4:56:54 PM: ────────────────────────────────────────────────────────────────
4:56:54 PM: 2. Build command from Netlify app
4:56:54 PM: ────────────────────────────────────────────────────────────────
4:56:54 PM: ​
4:56:54 PM: $ npm run build
4:56:54 PM: > dissertation@0.1.0 build
4:56:54 PM: > next build
4:56:55 PM: info - Loaded env from /opt/build/repo/.env
4:56:55 PM: info - Checking validity of types…
4:56:57 PM: info - Creating an optimized production build…
4:57:10 PM: info - Compiled successfully
4:57:10 PM: info - Collecting page data…
4:57:14 PM: info - Generating static pages (0/13)
4:57:17 PM: info - Generating static pages (3/13)
4:57:17 PM: info - Generating static pages (6/13)
4:57:17 PM: info - Generating static pages (9/13)
4:57:18 PM: info - Generating static pages (13/13)
4:57:18 PM: info - Finalizing page optimization…
4:57:18 PM: Page Size First Load JS
4:57:18 PM: ┌ ○ / (2705 ms) 2.33 kB 969 kB
4:57:18 PM: ├ /_app 0 B 772 kB
4:57:18 PM: ├ ○ /404 197 B 772 kB
4:57:18 PM: ├ λ /api/hello 0 B 772 kB
4:57:18 PM: ├ ○ /CategoryPage (2809 ms) 1.4 kB 943 kB
4:57:18 PM: ├ ○ /History (2839 ms) 20.6 kB 963 kB
4:57:18 PM: ├ ○ /ListItem (2804 ms) 21.6 kB 964 kB
4:57:18 PM: ├ ○ /Prizes (2917 ms) 2.82 kB 945 kB
4:57:18 PM: ├ ○ /ProductPage (2736 ms) 1.13 kB 943 kB
4:57:18 PM: ├ ○ /Profile (2693 ms) 1.24 kB 943 kB
4:57:18 PM: ├ ○ /SearchResults (2818 ms) 1.24 kB 943 kB
4:57:18 PM: ├ ○ /SellToken (3081 ms) 261 kB 1.2 MB
4:57:18 PM: ├ └ css/2db55f562be1f3dd.css 1.5 kB
4:57:18 PM: ├ ○ /Tax (2867 ms) 85.5 kB 1.05 MB
4:57:18 PM: └ ○ /UserBoard (2612 ms) 1.88 kB 944 kB
4:57:18 PM: + First Load JS shared by all 772 kB
4:57:18 PM: ├ chunks/framework-79bce4a3a540b080.js 42.1 kB
4:57:18 PM: ├ chunks/main-7d37069494070a99.js 27.7 kB
4:57:18 PM: ├ chunks/pages/_app-603fb6757e9dd20d.js 699 kB
4:57:18 PM: ├ chunks/webpack-90084247e0e9a43d.js 2.74 kB
4:57:18 PM: └ css/e32b332875d68ea6.css 3.92 kB
4:57:18 PM: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
4:57:18 PM: ○ (Static) automatically rendered as static HTML (uses no initial props)
4:57:18 PM: ​
4:57:18 PM: (build.command completed in 23.8s)
4:57:18 PM: ​
4:57:18 PM: ────────────────────────────────────────────────────────────────
4:57:18 PM: 3. @netlify/plugin-nextjs (onBuild event)
4:57:18 PM: ────────────────────────────────────────────────────────────────
4:57:18 PM: ​
4:57:18 PM: Patching /opt/build/repo/node_modules/next/dist/server/base-server.js
4:57:18 PM: Done
4:57:18 PM: Patching /opt/build/repo/node_modules/next/dist/server/next-server.js
4:57:18 PM: Done
4:57:18 PM: Moving static page files to serve from CDN…
4:57:18 PM: Moved 11 files
4:57:18 PM: Using Netlify Edge Functions for image format detection. Set env var “NEXT_DISABLE_EDGE_IMAGES=true” to disable.
4:57:18 PM: Netlify configuration property “redirects” value changed to [
4:57:18 PM: { from: ‘/next/static/', to: ‘/static/:splat’, status: 200 },
4:57:18 PM: {
4:57:18 PM: from: '/_next/image
’,
4:57:18 PM: query: { url: ‘:url’, w: ‘:width’, q: ‘:quality’ },
4:57:18 PM: to: '/ipx/w:width,q
:quality/:url’,
4:57:18 PM: status: 301
4:57:18 PM: },
4:57:18 PM: { from: ‘/_ipx/', to: ‘/.netlify/builders/_ipx’, status: 200 },
4:57:18 PM: { from: '/cache/
’, to: ‘/404.html’, status: 404, force: true },
4:57:18 PM: { from: ‘/server/', to: ‘/404.html’, status: 404, force: true },
4:57:18 PM: { from: '/serverless/
’, to: ‘/404.html’, status: 404, force: true },
4:57:18 PM: { from: ‘/trace’, to: ‘/404.html’, status: 404, force: true },
4:57:18 PM: { from: ‘/traces’, to: ‘/404.html’, status: 404, force: true },
4:57:18 PM: {
4:57:18 PM: from: ‘/routes-manifest.json’,
4:57:18 PM: to: ‘/404.html’,
4:57:18 PM: status: 404,
4:57:18 PM: force: true
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/build-manifest.json’,
4:57:18 PM: to: ‘/404.html’,
4:57:18 PM: status: 404,
4:57:18 PM: force: true
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/prerender-manifest.json’,
4:57:18 PM: to: ‘/404.html’,
4:57:18 PM: status: 404,
4:57:18 PM: force: true
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/react-loadable-manifest.json’,
4:57:18 PM: to: ‘/404.html’,
4:57:18 PM: status: 404,
4:57:18 PM: force: true
4:57:18 PM: },
4:57:18 PM: { from: ‘/BUILD_ID’, to: ‘/404.html’, status: 404, force: true },
4:57:18 PM: {
4:57:18 PM: from: ‘/api’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/api/',
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/favicon.ico’,
4:57:18 PM: to: ‘/favicon.ico’,
4:57:18 PM: conditions: { Cookie: [Array] },
4:57:18 PM: status: 200
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/vercel.svg’,
4:57:18 PM: to: ‘/vercel.svg’,
4:57:18 PM: conditions: { Cookie: [Array] },
4:57:18 PM: status: 200
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: '/
’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: conditions: { Cookie: [Array] },
4:57:18 PM: force: true
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/_next/data/YGH4iqFO2YoQvPq_zk-Kb/index.json’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/_next/data/YGH4iqFO2YoQvPq_zk-Kb/CategoryPage.json’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/CategoryPage’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/_next/data/YGH4iqFO2YoQvPq_zk-Kb/History.json’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/History’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/_next/data/YGH4iqFO2YoQvPq_zk-Kb/ListItem.json’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/ListItem’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/_next/data/YGH4iqFO2YoQvPq_zk-Kb/Prizes.json’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/Prizes’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/_next/data/YGH4iqFO2YoQvPq_zk-Kb/ProductPage.json’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/ProductPage’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/_next/data/YGH4iqFO2YoQvPq_zk-Kb/Profile.json’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/Profile’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/_next/data/YGH4iqFO2YoQvPq_zk-Kb/SearchResults.json’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/SearchResults’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/_next/data/YGH4iqFO2YoQvPq_zk-Kb/SellToken.json’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/SellToken’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/_next/data/YGH4iqFO2YoQvPq_zk-Kb/Tax.json’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/Tax’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/_next/data/YGH4iqFO2YoQvPq_zk-Kb/UserBoard.json’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/UserBoard’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200,
4:57:18 PM: force: false
4:57:18 PM: },
4:57:18 PM: {
4:57:18 PM: from: ‘/*’,
4:57:18 PM: to: ‘/.netlify/functions/___netlify-handler’,
4:57:18 PM: status: 200
4:57:18 PM: }
4:57:18 PM: ].
4:57:18 PM: ​
4:57:18 PM: (@netlify/plugin-nextjs onBuild completed in 47ms)
4:57:18 PM: ​
4:57:18 PM: ────────────────────────────────────────────────────────────────
4:57:18 PM: 4. Functions bundling
4:57:18 PM: ────────────────────────────────────────────────────────────────
4:57:18 PM: ​
4:57:18 PM: Packaging Functions from .netlify/functions-internal directory:
4:57:18 PM: - ___netlify-handler/___netlify-handler.js
4:57:18 PM: - ___netlify-odb-handler/___netlify-odb-handler.js
4:57:18 PM: - _ipx/_ipx.js
4:57:18 PM: ​
4:57:36 PM: ​
4:57:36 PM: (Functions bundling completed in 18.2s)
4:57:36 PM: ​
4:57:36 PM: ────────────────────────────────────────────────────────────────
4:57:36 PM: 5. Edge Functions bundling
4:57:36 PM: ────────────────────────────────────────────────────────────────
4:57:36 PM: ​
4:57:36 PM: Packaging Edge Functions from .netlify/edge-functions directory:
4:57:36 PM: - ipx
4:57:37 PM: ​
4:57:37 PM: (Edge Functions bundling completed in 449ms)
4:57:37 PM: ​
4:57:37 PM: ────────────────────────────────────────────────────────────────
4:57:37 PM: 6. @netlify/plugin-nextjs (onPostBuild event)
4:57:37 PM: ────────────────────────────────────────────────────────────────
4:57:37 PM: ​
4:57:37 PM: Next.js cache saved.
4:57:37 PM: ​
4:57:37 PM: (@netlify/plugin-nextjs onPostBuild completed in 422ms)
4:57:37 PM: ​
4:57:37 PM: ────────────────────────────────────────────────────────────────
4:57:37 PM: 7. Deploy site
4:57:37 PM: ────────────────────────────────────────────────────────────────
4:57:37 PM: ​
4:57:37 PM: Starting to deploy site from ‘.next’
4:57:41 PM: Creating deploy tree
4:57:41 PM: Creating deploy upload records
4:57:42 PM: 32 new files to upload
4:57:42 PM: 3 new functions to upload
4:57:49 PM: Site deploy was successfully initiated
4:57:49 PM: ​
4:57:49 PM: (Deploy site completed in 11.3s)
4:57:49 PM: ​
4:57:49 PM: ────────────────────────────────────────────────────────────────
4:57:49 PM: Netlify Build Complete
4:57:49 PM: ────────────────────────────────────────────────────────────────
4:57:49 PM: ​
4:57:49 PM: (Netlify Build completed in 55.9s)
4:57:49 PM: Starting post processing
4:57:49 PM: Caching artifacts
4:57:49 PM: Started saving node modules
4:57:49 PM: Finished saving node modules
4:57:49 PM: Started saving build plugins
4:57:49 PM: Finished saving build plugins
4:57:49 PM: Started saving pip cache
4:57:49 PM: Post processing - HTML
4:57:49 PM: Finished saving pip cache
4:57:49 PM: Started saving emacs cask dependencies
4:57:49 PM: Finished saving emacs cask dependencies
4:57:49 PM: Started saving maven dependencies
4:57:49 PM: Finished saving maven dependencies
4:57:49 PM: Started saving boot dependencies
4:57:49 PM: Finished saving boot dependencies
4:57:49 PM: Started saving rust rustup cache
4:57:49 PM: Finished saving rust rustup cache
4:57:49 PM: Started saving go dependencies
4:57:49 PM: Finished saving go dependencies
4:57:49 PM: Build script success
4:57:50 PM: Post processing - header rules
4:57:50 PM: Post processing - redirect rules
4:57:50 PM: Post processing done
4:57:54 PM: Site is live :sparkles:
4:58:34 PM: Uploading Cache of size 412.4MB
4:58:37 PM: Finished processing build request in 2m1.671861733s

Hey @ChrisGimlore,

Based on this:

You don’t need the environment variable any more and should have this URL in your next.config.js. Do you have it there? if yes, could you share your config or the repo?

Hi there,

my next.config.js is below:

/** @type {import(‘next’).NextConfig} */
const nextConfig = { reactStrictMode: false,
webpack5: true,
webpack(config) {
config.resolve.fallback = {
…config.resolve.fallback, // if you miss it, all the other options in fallback, specified
// by next.js will be dropped. Doesn’t make much sense, but how it is
fs: false, // the solution
};
return config;
},
images: {
domains: [
i.etsystatic.com’,
ipfs.moralis.io”,
https://netlify-thinks-chrisgimlore-is-great.netlify.app
],
},
}
and is why I added it to the environment variables

many thanks

i have the same problem

Hey there, @ChrisGimlore :wave:

Thanks for your patience here. looking at your next.config.js, it looks like you have two domains and then a full URL. Can you try removing the https:// in front of https://netlify-thinks-chrisgimlore-is-great.netlify.app](https://netlify-thinks-chrisgimlore-is-great.netlify.app/?

Here is some additional documentation that may be beneficial for you about this:

Hey there @najihmld :wave:

Thanks for reaching out! Sorry to hear you are encountering obstacles. We will need a bit more information in order to help you further. Please share:

  • a full description of the issue you are encountering
  • a link to your netlify site
  • a full copy of your most recent deploy log
  • your next.config.js and any additional build settings

I’ve changed it and still have the error. Do I need to change my netify verson perhaps?

Hey there, @ChrisGimlore :wave:

Thanks for following up. Can you elaborate on what you mean by netlify version? When I load your site I am now able to see all of your images and no longer see the error. Can you share a link to where you are still seeing the error?

This is what I see when I load your site:

Hi Hillary,

I’ve changed all the next/ images to regular html img tags so that’s why they’re visible now. I’m just going to go with this fix for now.