I try to load a dynamic URL with a parameter to specify what font to load in my function, but cannot seem to import a dynamic URL using the experimental-edge runtime in Next.js.
It works when I use a static URL. See the code below:
let fontName = "Lato-Regular.tff";
let staticURL = new URL(`/public/static/font/Lato-Regular.ttf`, import.meta.url);
let dynamicURL = new URL(`/public/static/font/${fontName}`, import.meta.url);
console.log("Static URL:)", staticURL.toString());
console.log("Dynamic URL:)", dynamicURL.toString());
And here is what I get when I print in the console:
Static URL: blob:Lato-Regular.4291f48c2ea51320.ttf
Dynamic URL: file:///public/static/font/Lato-Regular.tff
Ie. the static URL is interpreted correctly and can be used as a font, but the dynamic one does not work and gives me an error when I then use it to fetch().
Anyone that can help out on this?