#SOLVED - [NoImageMetadata] error only in Github Actions

24 messages · Page 1 of 1 (latest)

bold glade
#

Hello,

I am trying to set up some automated checks for my astro/starlight site which include a build step. The build step works on my local system (macos 14.2.1) as well as on my remote server (Ubuntu 22.04) but when it runs via Github Actions it errors out with the following error:

[NoImageMetadata] Could not process image metadata for `/home/runner/work/starlight-image-error/starlight-image-error/src/assets/test.webp`.
  Hint:
    This is often caused by a corrupted or malformed image. Re-exporting the image from your image editor may fix this issue.
  Error reference:
    https://docs.astro.build/en/reference/errors/no-image-metadata/
  Stack trace:
    at imageMetadata (file:///home/runner/work/starlight-image-error/starlight-image-error/node_modules/astro/dist/assets/utils/metadata.js:6:11)
    at async Object.transform (file:///home/runner/work/starlight-image-error/starlight-image-error/node_modules/astro/dist/content/runtime-assets.js:7:24)
    at async file:///home/runner/work/starlight-image-error/starlight-image-error/node_modules/zod/lib/index.mjs:2560:29
    at async file:///home/runner/work/starlight-image-error/starlight-image-error/node_modules/zod/lib/index.mjs:2267:32
    at async ZodObject.safeParseAsync (file:///home/runner/work/starlight-image-error/starlight-image-error/node_modules/zod/lib/index.mjs:677:24)
Error: Process completed with exit code 1.

Here is my reproduction repo. Emphasis was made on removing essentially everything else while still getting the error on Github Actions. As you will see it is very bare bones.

I have done everything under the sun I feel like to resolve this. It errors on any image, I have tried new images, re-exporting images, new image files, different node versions, different ubuntu versions, different sharp versions. So I am quite lost.

Please feel free to ping me if needed!

#

Here is my npx astro info from my local system

Astro                    v4.1.1
Node                     v21.1.0
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/starlight

Here is my npx astro info from my Github Actions runner

Astro                    v4.1.1
Node                     v18.19.0
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/starlight

Note: I have tried running the Github Actions runner in node v 21.1.0

potent gale
#

Hey I got the Could not process image metadata error on my local machine with your repo - re-saving the test.webp in an editor like the error said got past it.

Node v20.9.0 - maybe that will help

bold glade
# potent gale Hey I got the `Could not process image metadata` error on my local machine with ...

I got the error on my local machine when I loaded it back up, fixed the files, ran the build again on my local machine and it worked. Then when I pushed to git the action failed with the same build error. Both local machine and Github Action runner had node 20.9.0.

I thought this might be an issue with lfs but I was able to remove this in my original repo and my reproduction repo never had any lfs files to begin with.

potent gale
#

It looks like you haven't updated the test.webp in your repo - you'll need to disable the action for now, otherwise it will just keep failing

bold glade
#

I am just generally very confused with what I thought was a simple error, and at this point would just like to be able to move on to other items

crisp coral
#

Is this image in Markdown?

#

If so, unfortunately not at this time

bold glade
#

I am linking this image in the hero section of my index.mdx of starlight

crisp coral
#

Oh, I'm not sure if Starlight has that option cc @undone nexus

bold glade
#

I will note this error is happening to all of my images no matter what and these are all being linked in my mdx or md files. It's just the first one to error has been the one linked in my index.mdx hero section (and the only one I included in my reproduction).

crisp coral
#

That's quite weird!

#

Never saw that before

bold glade
#

I spent about 2 days, confident it was my fault, and searching all of the issues and support items available. Especially since it seems like such a simple error. I guess the weirdest thing to me is my ability to build on my local machine and a remote server, just not a github action runner

crisp coral
#

I've definitely built and saw people build websites with images just fine on GitHub Actions, so honestly, I have no idea. I'm sorry.

bold glade
#

I may try starting from scratch again and just going very slowly to see if I can pinpoint an exact point I run into the problem. I'll send an update once I've completed that

undone nexus
bold glade
#

So I am extremely confused, I made a new repo and started from installation of starlight and copied in all my content, customizations, etc and it works now!

The only thing I can think of is a potential lfs issue. In my original repo I used lfs at the start and when I ran into these errors I untracked those images and tried re exporting them, unsure if that could be the potential issue. I am quite unfamiliar with git lfs so you all may know better than me.

Ultimately I'm just happy it works now, even if it means I have to move to a new repo.

bold glade
#

I may have spoken too soon I'm afraid, everything was working until I transferred the new repo into my organization, the error is now back. Will be looking into origanization settings, however I'm unsure why that would be impacting me in this instance.

bold glade
#

I figured it out!!

Leaving this here in case anyone else runs into this issue.

I had * text eol=lf in my .gitattributes which was resulting in unwanted changes to my asset files.

I simply added the following to my git attributes and everything worked!

/src/assets/** -text
/public/** -text
#

SOLVED - [NoImageMetadata] error only in Github Actions

undone nexus