Next.js Discord

Discord Forum

Invalid URL at URL constructor???

Unanswered
Griffon Nivernais posted this in #help-forum
Open in Discord
Griffon NivernaisOP
Not sure if it's a bug in Next or if I've lost touch in JS.

7 Replies

Griffon NivernaisOP
Would be nice if Flameshot actually copied to my clipboard. :angerytinfoil:
  69 | export default async function postcodes(req, res) {
  70 | const { postcode } = req.query;
> 71 | const url = new URL(`/api/postcodes/${postcode}`, process.env.API_DOMAIN);
     |            ^
  72 | console.log(url);
  73 | url.search = "";
  74 | const response = await fetch(url, {
so add || ""
thats my assumption of the error
Griffon NivernaisOP
You'd be correct. :blobpain:
Thank you so much.