Gatsby-plugin : no such file or directory, copyfile '/opt/build/repo/node_modules/@netlify/plugin-gatsby/src/templates/ipx.ts' -> '.netlify/functions-internal/_ipx.ts'

Hello,
I’m try to use Gatsby Image CDN, related on Netlify blog but the existing repo seems outdated.
So i’ve fork the repo here, but the build fails during plugin task, and I don’t understand why …

here is the public repo (up-to-date, with Gatsby 4) to reproduce the bug.
github.com/violy/wordpress-gatsby-demo/
(fork of ascorbic/wordpress-gatsby-demo)

and here is the build log error

────────────────────────────────────────────────────────────────
  Plugin "@netlify/plugin-gatsby" internal error
────────────────────────────────────────────────────────────────
​
  Error message
  Error: ENOENT: no such file or directory, copyfile '/opt/build/repo/node_modules/@netlify/plugin-gatsby/src/templates/ipx.ts' -> '.netlify/functions-internal/_ipx.ts'
​
  Plugin details
  Package:        @netlify/plugin-gatsby
  Version:        3.4.8
  Repository:     git+https://github.com/netlify/netlify-plugin-gatsby.git
  npm link:       https://www.npmjs.com/package/@netlify/plugin-gatsby
  Report issues:  https://github.com/netlify/netlify-plugin-gatsby/issues
​
  Error location
  In "onBuild" event in "@netlify/plugin-gatsby" from netlify.toml and package.json
​
  Error properties
  {
    errno: -2,
    code: 'ENOENT',
    syscall: 'copyfile',
    path: '/opt/build/repo/node_modules/@netlify/plugin-gatsby/src/templates/ipx.ts',
    dest: '.netlify/functions-internal/_ipx.ts'
  }

Thanks.

Thank you for letting us know, @violy! We’ve passed this to the devs.

1 Like

Thank you, waiting for a solution !

Also, using gatsby-plugin-netlify with latest Gatsby V5 major version, I’ve a Warning :

warn Plugin gatsby-plugin-netlify is not compatible with your gatsby version 5.2.0 - It requires gatsby@^4.0.0

Gatsby 5 compatibility is currently being tested, it’s not yet released.

The fix for the reported issue has been released in v3.5.1: Release plugin-gatsby: v3.5.1 · netlify/netlify-plugin-gatsby · GitHub

Thanks for the fix.

After 3.5.1 upgrade, the Netlify build is now complete… but… Image CDN still not working.
All images are in 404 with this status :

Source image server responsed with 404 Not Found

The repo used to reproduce is the same as previously mentioned in my initial post.

NB : When I’m using Netlify CLI locally, and running

netlify dev

the _ipx Function is working fine locally and images is served…

but this function steel fails in “real” build on Netlify.

OK, could you link us to your newest build’s logs, so we can take a look at what might be going wrong? What have you tried already to fix this?

Thank you for your quick answer !

Here is my full latest production build log.
There is no explicit error/warning log on _ipx Function.

4:44:51 PM: Build ready to start
4:44:54 PM: build-image version: 1ca34a93198b041e44214013884c57d146a23fed (focal)
4:44:54 PM: build-image tag: v4.16.4
4:44:54 PM: buildbot version: 2577a19e1559072eeb7a6727cec389b63b90401c
4:44:55 PM: Fetching cached dependencies
4:44:55 PM: Starting to download cache of 461.5MB
4:44:58 PM: Finished downloading cache in 3.777s
4:44:58 PM: Starting to extract cache
4:45:04 PM: Finished extracting cache in 5.686s
4:45:04 PM: Finished fetching cache in 9.543s
4:45:04 PM: Starting to prepare the repo for build
4:45:04 PM: Preparing Git Reference refs/heads/main
4:45:05 PM: Parsing package.json dependencies
4:45:06 PM: Starting build script
4:45:06 PM: Installing dependencies
4:45:06 PM: Python version set to 2.7
4:45:06 PM: Started restoring cached Node.js version
4:45:08 PM: Finished restoring cached Node.js version
4:45:08 PM: v18.13.0 is already installed.
4:45:08 PM: Now using node v18.13.0 (npm v8.19.3)
4:45:08 PM: Enabling Node.js Corepack
4:45:08 PM: Started restoring cached build plugins
4:45:08 PM: Finished restoring cached build plugins
4:45:08 PM: Attempting Ruby version 2.7.2, read from environment
4:45:09 PM: Using Ruby version 2.7.2
4:45:09 PM: Using PHP version 8.0
4:45:09 PM: Started restoring cached corepack dependencies
4:45:09 PM: mv: cannot move '/opt/build/cache/.node/corepack' to '/opt/buildhome/.node/corepack': No such file or directory
4:45:09 PM: Finished restoring cached corepack dependencies
4:45:09 PM: Started restoring cached yarn cache
4:45:13 PM: Finished restoring cached yarn cache
4:45:14 PM: No yarn workspaces detected
4:45:14 PM: Started restoring cached node modules
4:45:14 PM: Finished restoring cached node modules
4:45:14 PM: Installing npm packages using Yarn version 1.22.19
4:45:14 PM: yarn install v1.22.19
4:45:14 PM: [1/4] Resolving packages...
4:45:14 PM: success Already up-to-date.
4:45:14 PM: Done in 0.38s.
4:45:14 PM: npm packages installed using Yarn
4:45:15 PM: Started restoring cached go cache
4:45:15 PM: Finished restoring cached go cache
4:45:15 PM: Installing Go version 1.17 (requested 1.17)
4:45:20 PM: unset GOOS;
4:45:20 PM: unset GOARCH;
4:45:20 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
4:45:20 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
4:45:20 PM: go version >&2;
4:45:20 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
4:45:20 PM: go version go1.17 linux/amd64
4:45:21 PM: Detected 1 framework(s)
4:45:21 PM: "gatsby" at version "5.5.0"
4:45:21 PM: Installing missing commands
4:45:21 PM: Verify run directory
4:45:21 PM: Section completed: initializing
4:45:22 PM: ​
4:45:22 PM:   Netlify Build                                                 
4:45:22 PM: ────────────────────────────────────────────────────────────────
4:45:22 PM: ​
4:45:22 PM: ❯ Version
4:45:22 PM:   @netlify/build 29.5.1
4:45:22 PM: ​
4:45:22 PM: ❯ Flags
4:45:22 PM:   baseRelDir: true
4:45:22 PM:   buildId: 63d14e724990820008e441db
4:45:22 PM:   deployId: 63d14e724990820008e441dd
4:45:22 PM: ​
4:45:22 PM: ❯ Current directory
4:45:22 PM:   /opt/build/repo
4:45:22 PM: ​
4:45:22 PM: ❯ Config file
4:45:22 PM:   /opt/build/repo/netlify.toml
4:45:22 PM: ​
4:45:22 PM: ❯ Context
4:45:22 PM:   production
4:45:22 PM: ​
4:45:22 PM: ❯ Loading plugins
4:45:22 PM:    - @netlify/plugin-gatsby@3.5.1 from netlify.toml and package.json
4:45:24 PM: ​
4:45:24 PM:   1. @netlify/plugin-gatsby (onPreBuild event)                  
4:45:24 PM: ────────────────────────────────────────────────────────────────
4:45:24 PM: ​
4:45:24 PM: Found a Gatsby cache. We’re about to go FAST. ⚡️
4:45:24 PM: ​
4:45:24 PM: (@netlify/plugin-gatsby onPreBuild completed in 306ms)
4:45:24 PM: ​
4:45:24 PM:   2. build.command from netlify.toml                            
4:45:24 PM: ────────────────────────────────────────────────────────────────
4:45:24 PM: ​
4:45:24 PM: $ yarn build
4:45:24 PM: yarn run v1.22.19
4:45:24 PM: $ GATSBY_CLOUD_IMAGE_CDN=1 gatsby build
4:45:27 PM: success compile gatsby files - 0.942s
4:45:27 PM: success load gatsby config - 0.021s
4:45:28 PM: success load plugins - 0.753s
4:45:28 PM: warning gatsby-plugin-react-helmet: Gatsby now has built-in support for modifying the document head. Learn more at https://gatsby.dev/gatsby-head
4:45:28 PM: success onPreInit - 0.004s
4:45:28 PM: success delete worker cache from previous builds - 0.002s
4:45:28 PM: info One or more of your plugins have changed since the last time you ran Gatsby. As
4:45:28 PM: a precaution, we're deleting your site's cache to ensure there's no stale data.success initialize cache - 0.075s
4:45:28 PM: success copy gatsby files - 0.098s
4:45:28 PM: success Compiling Gatsby Functions - 0.214s
4:45:28 PM: success onPreBootstrap - 0.240s
4:45:30 PM: success  gatsby-source-wordpress  ensuring plugin requirements are met - 1.000s
4:45:30 PM: ⠀
4:45:30 PM: info  gatsby-source-wordpress 
4:45:30 PM: 	This is either your first build or the cache was cleared.
4:45:30 PM: 	Please wait while your WordPress data is synced to your Gatsby cache.
4:45:30 PM: 	Maybe now's a good time to get up and stretch? :D
4:45:32 PM: success  gatsby-source-wordpress  ingest WPGraphQL schema - 1.707s
4:45:32 PM: success createSchemaCustomization - 2.803s
4:45:32 PM: success  gatsby-source-wordpress  fetch root fields - 0.390s
4:45:33 PM: success  gatsby-source-wordpress  Menu - 0.585s - fetched 0
4:45:33 PM: success  gatsby-source-wordpress  MenuItem - 0.885s - fetched 0
4:45:33 PM: success  gatsby-source-wordpress  Taxonomy - 0.885s - fetched 3
4:45:33 PM: success  gatsby-source-wordpress  Comment - 0.987s - fetched 29
4:45:33 PM: success  gatsby-source-wordpress  PostFormat - 1.184s - fetched 9
4:45:33 PM: success  gatsby-source-wordpress  UserRole - 1.282s - fetched 0
4:45:34 PM: success  gatsby-source-wordpress  User - 1.482s - fetched 1
4:45:34 PM: success  gatsby-source-wordpress  ContentType - 1.487s - fetched 3
4:45:34 PM: success  gatsby-source-wordpress  Category - 1.988s - fetched 67
4:45:34 PM: success  gatsby-source-wordpress  Page - 2.084s - fetched 21
4:45:35 PM: success  gatsby-source-wordpress  Tag - 2.883s - fetched 112
4:45:36 PM: success  gatsby-source-wordpress  Post - 3.815s - fetched 48
4:45:47 PM: success  gatsby-source-wordpress  MediaItem - 11.079s - fetched 38
4:45:47 PM: success  gatsby-source-wordpress  creating nodes - 11.080s
4:45:47 PM: success  gatsby-source-wordpress  fetching nodes - 14.966s - 331 total
4:45:47 PM: success Downloading remote files - 9.276s - 37/37 3.99/s
4:45:47 PM: success Checking for changed pages - 0.000s
4:45:47 PM: success source and transform nodes - 15.374s
4:45:47 PM: info Writing GraphQL type definitions to /opt/build/repo/.cache/schema.gql
4:45:47 PM: success building schema - 0.364s
4:45:47 PM: success createPages - 0.048s
4:45:48 PM: success createPagesStatefully - 0.035s
4:45:48 PM: info Total nodes: 502, SitePage nodes: 55 (use --verbose for breakdown)
4:45:48 PM: success Checking for changed pages - 0.000s
4:45:48 PM: success Cleaning up stale page-data - 0.002s
4:45:48 PM: success onPreExtractQueries - 0.001s
4:45:48 PM: success  gatsby-source-wordpress  diff schemas - 0.521s
4:45:48 PM: success  gatsby-source-wordpress  ingest WPGraphQL schema - 0.609s
4:45:53 PM: success extract queries from components - 5.684s
4:45:53 PM: success write out redirect data - 0.001s
4:45:53 PM: success Build manifest and related icons - 0.131s
4:45:53 PM: success onPostBootstrap - 0.132s
4:45:53 PM: info bootstrap finished - 28.992s
4:45:53 PM: success write out requires - 0.002s
4:45:55 PM: success Building production JavaScript and CSS bundles - 1.863s
4:45:56 PM: success Building HTML renderer - 0.321s
4:45:56 PM: success Execute page configs - 0.034s
4:45:56 PM: success Caching Webpack compilations - 0.276s
4:45:56 PM: warning "TRACED_SVG" placeholder argument value is no longer supported (used in ImageSharp.gatsbyImageData processing), falling back to "DOMINANT_COLOR". See https://gatsby.dev/tracesvg-removal/
4:45:56 PM: success run queries in workers - 0.237s - 58/58 245.15/s
4:45:57 PM: success Running gatsby-plugin-sharp.IMAGE_PROCESSING jobs - 0.769s - 14/14 18.21/s
4:45:57 PM: success Merge worker state - 0.002s
4:45:57 PM: success Rewriting compilation hashes - 0.000s
4:45:57 PM: success Writing page-data.json and slice-data.json files to public directory - 0.017s - 55/55 3313.61/s
4:46:08 PM: success Building static HTML for pages - 9.186s - 55/55 5.99/s
4:46:08 PM: info There are no new or changed slice html files to build.
4:46:08 PM: success stiching slices - 0.202s
4:46:08 PM: info [gatsby-plugin-netlify] Creating SSR/DSG redirects...
4:46:08 PM: info [gatsby-plugin-netlify] Created 0 SSR/DSG redirects...
4:46:08 PM: warning  gatsby-source-wordpress  There were 1 files with file sizes that are above the maxFileSizeBytes config option and consequently were not fetched. Visit https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-wordpress/docs/debugging-and-troubleshooting.md#media-file-download-skipped for more info.
4:46:08 PM: success onPostBuild - 0.015s
4:46:09 PM: 
4:46:09 PM: Pages
4:46:09 PM: ┌ src/templates/blog-post.js
4:46:09 PM: │ ├   /block-image/
4:46:09 PM: │ └   ...47 more pages available
4:46:09 PM: ├ src/templates/blog-post-archive.js
4:46:09 PM: │ ├   /
4:46:09 PM: │ └   ...4 more pages available
4:46:09 PM: ├ src/pages/404.js
4:46:09 PM: │ ├   /404/
4:46:09 PM: │ └   /404.html
4:46:09 PM: └ src/api/hello-world.js
4:46:09 PM:   └ λ /api/hello-world
4:46:09 PM:   ╭────────────────────────────────────────────────────────────────────╮
4:46:09 PM:   │                                                                    │
4:46:09 PM:   │     (SSG) Generated at build time                                  │
4:46:09 PM:   │   D (DSG) Deferred static generation - page generated at runtime   │
4:46:09 PM:   │   ∞ (SSR) Server-side renders at runtime (uses getServerData)      │
4:46:09 PM:   │   λ (Function) Gatsby function                                     │
4:46:09 PM:   │                                                                    │
4:46:09 PM:   ╰────────────────────────────────────────────────────────────────────╯
4:46:09 PM: info Done building in 44.154689169 sec
4:46:09 PM: Done in 44.27s.
4:46:09 PM: ​
4:46:09 PM: (build.command completed in 44.4s)
4:46:09 PM: ​
4:46:09 PM:   3. @netlify/plugin-gatsby (onBuild event)                     
4:46:09 PM: ────────────────────────────────────────────────────────────────
4:46:09 PM: ​
4:46:09 PM: Enabling Gatsby API support
4:46:09 PM: Netlify configuration property "redirects" value changed to [
4:46:09 PM:   {
4:46:09 PM:     from: '/api/*',
4:46:09 PM:     query: {},
4:46:09 PM:     to: '/.netlify/functions/__api',
4:46:09 PM:     status: 200,
4:46:09 PM:     force: false,
4:46:09 PM:     conditions: {},
4:46:09 PM:     headers: {}
4:46:09 PM:   },
4:46:09 PM:   {
4:46:09 PM:     from: '/_gatsby/image/*',
4:46:09 PM:     to: '/.netlify/builders/_ipx',
4:46:09 PM:     status: 200
4:46:09 PM:   },
4:46:09 PM:   {
4:46:09 PM:     from: '/_gatsby/file/*',
4:46:09 PM:     to: '/.netlify/functions/_ipx',
4:46:09 PM:     status: 200
4:46:09 PM:   }
4:46:09 PM: ].
4:46:09 PM: ​
4:46:09 PM: (@netlify/plugin-gatsby onBuild completed in 25ms)
4:46:09 PM: ​
4:46:09 PM:   4. Functions bundling                                         
4:46:09 PM: ────────────────────────────────────────────────────────────────
4:46:09 PM: ​
4:46:09 PM: Packaging Functions from .netlify/functions-internal directory:
4:46:09 PM:  - _ipx.ts
4:46:09 PM:  - __api/__api.js
4:46:09 PM: ​
4:46:10 PM: ​
4:46:10 PM: (Functions bundling completed in 1.2s)
4:46:10 PM: ​
4:46:10 PM:   5. @netlify/plugin-gatsby (onPostBuild event)                 
4:46:10 PM: ────────────────────────────────────────────────────────────────
4:46:10 PM: ​
4:46:10 PM: Enabling Gatsby API support
4:46:10 PM: ​
4:46:10 PM: (@netlify/plugin-gatsby onPostBuild completed in 349ms)
4:46:10 PM: ​
4:46:10 PM:   6. Deploy site                                                
4:46:10 PM: ────────────────────────────────────────────────────────────────
4:46:10 PM: ​
4:46:10 PM: Starting to deploy site from 'public'
4:46:10 PM: Calculating files to upload
4:46:11 PM: 65 new files to upload
4:46:11 PM: 1 new functions to upload
4:46:18 PM: Section completed: deploying
4:46:22 PM: Starting post processing
4:46:22 PM: Post processing - HTML
4:46:28 PM: Post processing - header rules
4:46:28 PM: Post processing - redirect rules
4:46:28 PM: Post processing done
4:46:28 PM: Section completed: postprocessing
4:46:29 PM: Site is live ✨
4:46:31 PM: Finished waiting for live deploy in 12.105s
4:46:31 PM: Site deploy was successfully initiated
4:46:31 PM: ​
4:46:31 PM: (Deploy site completed in 20.3s)
4:46:31 PM: ​
4:46:31 PM:   7. @netlify/plugin-gatsby (onSuccess event)                   
4:46:31 PM: ────────────────────────────────────────────────────────────────
4:46:31 PM: ​
4:46:31 PM: ​
4:46:31 PM: (@netlify/plugin-gatsby onSuccess completed in 4ms)
4:46:31 PM: ​
4:46:31 PM:   Netlify Build Complete                                        
4:46:31 PM: ────────────────────────────────────────────────────────────────
4:46:31 PM: ​
4:46:31 PM: (Netlify Build completed in 1m 8.3s)
4:46:31 PM: Caching artifacts
4:46:31 PM: Started saving node modules
4:46:31 PM: Finished saving node modules
4:46:31 PM: Started saving build plugins
4:46:31 PM: Finished saving build plugins
4:46:31 PM: Started saving yarn cache
4:46:35 PM: Finished saving yarn cache
4:46:35 PM: Started saving pip cache
4:46:35 PM: Finished saving pip cache
4:46:35 PM: Started saving emacs cask dependencies
4:46:35 PM: Finished saving emacs cask dependencies
4:46:35 PM: Started saving maven dependencies
4:46:35 PM: Finished saving maven dependencies
4:46:35 PM: Started saving boot dependencies
4:46:35 PM: Finished saving boot dependencies
4:46:35 PM: Started saving rust rustup cache
4:46:35 PM: Finished saving rust rustup cache
4:46:35 PM: Started saving go dependencies
4:46:35 PM: Finished saving go dependencies
4:46:35 PM: Build script success
4:46:35 PM: Section completed: building
4:46:38 PM: Uploading Cache of size 485.4MB
4:46:41 PM: Section completed: cleanup
4:46:41 PM: Finished processing build request in 1m46.857s

Reminder :
You can reproduce the minimal reproduction build, by forking the Github repo /violy/wordpress-gatsby-demo. Thanks.

Thank you for the details. We’ve nudged the devs with the follow-up.

1 Like

Thank you for your support. Any news ?

Hi @violy ,

Thanks for following up - our developers are exploring options and working to find a good path forward. We will follow up with you once we know more!

This has been merged: feat: add support for query param url syntax of IMAGE CDN by pieh · Pull Request #566 · netlify/netlify-plugin-gatsby · GitHub, the next update should have this implemented.