Astro Image component error

I get a File URL must be absolute error when using a really simple Image component setup:
---
import { Image } from "astro:assets";
import image from "../assets/cross-watermark.png";
---

<div>
<Image
src={image}
alt=""
/>
</div>
---
import { Image } from "astro:assets";
import image from "../assets/cross-watermark.png";
---

<div>
<Image
src={image}
alt=""
/>
</div>
generating optimized images
error File URL path must be absolute
File:
[file path]
Code:
50 | const imageService = await getConfiguredImageService();
> 51 | const resultData = await imageService.transform(
| ^
52 | fileData,
53 | { ...options, src: originalImagePath },
54 | buildOpts.settings.config.image.service.config
Stacktrace:
TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must be absolute
generating optimized images
error File URL path must be absolute
File:
[file path]
Code:
50 | const imageService = await getConfiguredImageService();
> 51 | const resultData = await imageService.transform(
| ^
52 | fileData,
53 | { ...options, src: originalImagePath },
54 | buildOpts.settings.config.image.service.config
Stacktrace:
TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must be absolute
I could have swore I've used this exact setup in multiple projects... I googled it, and apparently it was an issue in May of last year until they pushed a fix for it. I already asked the Astro server (without much response), so I was wondering if anyone had a similar issue? Some additional information too is that it works in the dev environment and builds in Netlify, but doesn't build locally...
5 Replies
vince
vinceOPβ€’17mo ago
Just wanted to confirm that I do have a working copy of another site I used the Image component in and it builds completely fine. Did some back and forth with a kind member of the Astro community and I sent them the repo. The repo builds for them! But not for me. Very odd. I reinstalled my node packages and no dice Solved it by upgrading Astro version πŸ˜‚ Here is the Astro discord help thread, in case anyone in the future has this issue: https://discord.com/channels/830184174198718474/1138938915563262112
Chimi
Chimiβ€’17mo ago
At least it was a simple fix! Thanks for sharing this πŸ™‚
vince
vinceOPβ€’17mo ago
Yup yup no problem πŸ™‚
briancross
briancrossβ€’17mo ago
I hate problems like this lol. It’s good you got it going!
vince
vinceOPβ€’17mo ago
Thank you I do too πŸ˜‚
Want results from more Discord servers?
Add your server