Sveltekit and private images related: ERROR 9425 Image access denied: sig query-string argument is n
So trying to implement the signed URLs of private images in Sveltekit. I've done absolute minimal to translate the given URL signing solution at https://developers.cloudflare.com/images/cloudflare-images/serve-images/serve-private-images-using-signed-url-tokens
But it doesnt seem to work because of :
ERROR 9425: Image access denied: sig query-string argument is not properly hex-encoded (must be 64 hex chars)
Serve private images using signed URL tokens · Cloudflare Image Opt...
If an image is marked to require a signed URL, it cannot be accessed without a token unless it is being requested for a variant that is set to always …
5 Replies
My server endpoint code is below, whereas the literal only two things that I've changed is the
return
value (turned into string rather than URL), removed comments for the sake of less noise, and then added my env variable import.
Can anyone help explain why it would throw that error though I'm following the docs pretty much exactly?
When I console log on the server, the url looks fine, but in Postman/Insomnia and in the browser, it throws that error.
The function spits out a url like this (manually obfuscated):
https://imagedelivery.net/Zwety7eez57My5vN6lsp1g/2b49sa2n-3163-4335-14zt-c49fb388e401/w640?exp=1690438557&sig=c2d1d9342b8785fedaa53a2b03362afc55a951375684a60c256a272de7beb94c
Thank you for any help and guidance in advance.
I'm perplexed and can't find anything Googling. the sig param does look all hex and there are 64 characters in the returned sig param. ???@boggin. Did you ever figure this one out? Having exactly the same trouble
@o852 I got it fixed eventually. I have no clue what was different the second time I tried it that made it work correctly. I remember only changing 2-3 small details to make the code fit with my usage.
I'm using this as a function called from a server endpoint on Sveltekit, here's my code:
@boggin. thanks for the help...
4 days later - I realize there's a difference between the API key and the key used to serve images... yikes
That’s exactly what I discovered in my journey too! Thanks cloudflare…