image icon indicating copy to clipboard operation
image copied to clipboard

[@nuxt/image] Unexpected response IPX Error (500) when running in Github Actions

Open jacobmolby opened this issue 2 years ago • 12 comments

image

When running our action to generate and deploy our static site, we get the error above. It only happens in Github Actions, locally (on multiple different machines) it works.

An example usage of an image is

<nuxt-img
  src="/images/my-img.png"
  alt="Image"
  format="webp"
  width="1200"
  quality="100"
  loading="lazy"
  />

The nuxt config looks like this:

export default {
	ssr: true,
	target: 'static',
	buildModules: ['@nuxt/postcss8', 'nuxt-facebook-pixel-module', '@nuxt/image'],
        image: {
		        provider: 'static',
	        },
        // rest omitted...

The command we're running is nuxt generate

In https://github.com/nuxt/image/issues/250 he seemed to get the same error and it had something todo with the images not being on the file system? I tried to check that in the Action runner via tree unix command and they all appear to be there under ./static/images/etc.png.

We've tried both version 0.7.1 and 0.6.2. Both resulted in the same error.

The version of nuxt is 2.15.8

Any help would be greatly appreciated!

jacobmolby avatar Oct 03 '22 21:10 jacobmolby

Im looking for help on this issue as well, it's causing some of our CI pipelines to continue without failure? Even when running with nuxt generate --fail-on-error :confused:

surgiie avatar Feb 09 '23 21:02 surgiie

We figured it out.

We had cached our node_modules in the Action. However we hadn't included the OS in the cache key. So I imagine the issue was that the Sharp version wasn't installed with linux binaries.

Our current step looks like this:

      - name: Cache dependencies
        id: cache
        uses: actions/cache@v3
        with:
          path: ./node_modules
          key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}

      - name: Install dependencies
        if: steps.cache.outputs.cache-hit != 'true'
        run: npm ci

jacobmolby avatar Feb 10 '23 10:02 jacobmolby

My issue was that the filename was image.PNG, but I used image.png in the code. Windows does not differentiate between uppercase and lowercase letters so it worked locally. However, image.png doesn't exist in a Linux environment. rename your images.

MarioAda avatar Apr 22 '23 15:04 MarioAda

+1

vietanhbui avatar Sep 25 '23 11:09 vietanhbui

+1

Same problem here, I am trying to use the default nuxt/image config, and for the images that come from ipx http://localhost:3000/_ipx/s_328x224/images/banner/1.jpg for example I got the error 500 and missing sharp:

{
  "error": {
    "message": "
      [500] [IPX_ERROR] \nSomething went wrong installing the \"sharp\" module\n\nCannot find module 
      '../build/Release/sharp-linux-x64.node'\nRequire stack:\n- /home/.../node_modules/sharp/lib/sharp.js\n- 
      /home/.../node_modules/sharp/lib/constructor.js\n- /home/.../node_modules/sharp/lib/index.js\n\nPossible solutions:\n- 
      Install with verbose logging and look for errors: \"npm install --ignore-scripts=false --foreground-scripts --verbose sharp\"\n
      - Install for the current linux-x64 runtime: \"npm install --platform=linux --arch=x64 sharp\"\n- 
      Consult the installation documentation: https://sharp.pixelplumbing.com/install"
  }
}

In my case, I am working on WSL-Ubuntu and I also tried to deploy to vercel and there it worked fine. Just in localhost that not work.

luanmessias avatar Oct 12 '23 15:10 luanmessias

+1 same issue here, testing local with a default nuxt install

notflip avatar Oct 26 '23 08:10 notflip

I hope to reopen this question. I am using node20x and nuxt3.8. After the build, the local png image part will have this problem, but the local svg and remote jpg will have no problem.

songjianet avatar Oct 30 '23 02:10 songjianet

+1 here. I reverted my yarn.lock file and it started to work again. Not sure if this has been an error in the recent releases.

MarGul avatar Nov 07 '23 09:11 MarGul

I hope to reopen this question. I am using node20x and nuxt3.8. After the build, the local png image part will have this problem, but the local svg and remote jpg will have no problem.

I solved this problem by installing the sharp dependency in the project.

songjianet avatar Nov 09 '23 02:11 songjianet

For me it works on Vercel when i deploy, but not locally, i tried installing sharp dependency but didn´t work as well

Fernando12mais avatar Jan 21 '24 22:01 Fernando12mais

yarn add sharp --ignore-engines

this command make it work for me, i was missing this 'ignore-engines 'prefix

Fernando12mais avatar Jan 21 '24 22:01 Fernando12mais

This is still a problem in 2024 and I have no choice but to install sharp again and again.

Puggo1145 avatar Mar 03 '24 04:03 Puggo1145