#Local images with `astro:assets` not working on wsl ?

36 messages Β· Page 1 of 1 (latest)

tight vine
#

I'm trying for a couple of week to migrate to astro@v3 and convert images from astrojs/image to astro:assets and it works fine for remote but the local images does not seem to work at all, i'm so confused. I'm wandering if it has to do with this issue ? Seems like trying to fetch local image from uri on my windows with the path on my wsl maybe ? not sure at all what could be caused by this. I can't switch to astro:assets to this day because of this issue sadly :c

(For context the images just gives me 404 in the network tab, no error on server side even with the --verbose flag)

GitHub

What version of astro are you using? 1.6.13 Are you using an SSR adapter? If so, which one? None What package manager are you using? yarn What operating system are you using? Mac Describe the Bug I...

slim violetBOT
#
No-one around right now?

It looks like no-one has responded to your question yet. People might not be available right now or don’t know how to answer your question. Want an answer while you wait? Try asking our experimental bot in #1095492539085230272.

steady wigeon
#

Hi! This is exactly my issue as well (not using wsl). No idea how should I proceed.

kindred thicket
#

@astrojs/image fetched images the same way than astro:assets does, so if it worked for it, the issue is probably not that one

steady wigeon
#

The paths (after /@fs/ seem to be alright, the dimensions on the images seem to be correct, but fetching them throw 404.

bootstrapping an astro starter works just fine, serves local images as expected.

kindred thicket
#

So this is only in your project, but it doesn't happens in a new project?

steady wigeon
#

yes

kindred thicket
#

Is there any chance you can share your project?

steady wigeon
#

no, unfortunatelly. :/

steady wigeon
#

I tried to reproduce the migration steps in a starter project, but it just works as expected.

kindred thicket
#

Suffering from success πŸ˜„

#

Unfortunately, without a reproduction I can't really do anything. But if anyone encountering this issue can share a repro I'd be happy to look at it!

steady wigeon
#

@kindred thicket I went in with a debugger and found that in the "image-endpoint.js" calling "loadRemoteImage(src)" we get a fetch error with the following:

cause: Error: unable to verify the first certificate
    at TLSSocket.onConnectSecure (node:_tls_wrap:1540:34)
    at TLSSocket.emit (node:events:513:28)
    at TLSSocket._finishInit (node:_tls_wrap:959:8)
    at ssl.onhandshakedone (node:_tls_wrap:743:12)
    at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
  code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
}
kindred thicket
#

That seems like a weird SSL issue, what OS are you on?

tight vine
#

ooh, i'm on https for dev maybe it's the issue ?

#

don't have time rn but i'll try layter to switch on http

kindred thicket
#

I can hear the "why does it fetch in local" question already πŸ˜”

tight vine
#

lol

#

i saw and readed the issue linked and the reasons you provided, i'll not ask another time xD

#

but that's an interesting point, my certificate is marked as trusted on my windows but i don't think it's forwarded on WSL too

#

because it's a simple self-signed on localhost

#

i need https for the service worker and the sharing api

#

maybe ignore trusting https or cors on dev mode ?

#

at least for local image fetching

kindred thicket
#

I don't think there's an easy, safe way to ignore those cert errors, is there?

tight vine
#

there's that at least but not "practical"

const httpsAgent = new https.Agent({
  rejectUnauthorized: false,
});
#

technically it's fine with local image but yeah i can see the issue in the long term

steady wigeon
#

you can add the cert to https.globalAgent or we used the NODE_EXTRA_CA_CERTS envvar to add the cert

tight vine
#

it's only for node sadly

#

need to work on all env

#

i'll try

steady wigeon
#

a better solution would be maybe for @kindred thicket to expose the fetch, or just remove the fetching in local altogether πŸ˜„

tight vine
#

expose on the astro config ?

steady wigeon
#

sure

tight vine
#

i mean you can add the cert on the config why not include them directly on astro

steady wigeon
#

idk the reasons, but it was an interesting couple of days to figure this out πŸ˜„