Funtion 502 error


I got a weird error blocking my ability to submit a booking form ( even after I upgraded from Hugo 0.88 to 0.92 )

The console error is

Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0

and the culprit is this bit of baseof.html:

<!DOCTYPE html><!--[if IE 8]> <html class="ie ie8"> <![endif]--><!--[if IE 9]> <html class="ie ie9"> <![endif]-->
<html lang="en-gb">

I removed these MS commands and the Netlify function worked once but it stopped after the next text change. For some reason the MS commands were back again (on Netlify but not on my version)!
I then got another problem with my javascript function on Netlify as it could not locate my function:

line 82:  let response = await fetch('/.netlify/functions/booking', { 

Any ideas how best to deal with this? Its odd that it worked this morning and it stopped as soon as I add a Hugo (humanize) function to it. It seems all JS related though.


Hi @ourmaninindia,

Could you share your function code? It looks like you’re trying some kind of JSON.parse() in your function and the string you’re sending in it is not a valid JSON.