This behavior started occurring in a recent Marketing Cloud release. It occurs when you preview the CloudPage before publishing. It appears that Salesforce has changed the way that CloudPages are interpreted (and now use the same process as email previews). If you publish the page, then this error should not occur and your code will be interpreted correctly.
You will have hard time fetching these values with SSJS, as the request you are executing is done in frontend Java Script (where SSJS is running in the backend). This means, that the response received is "too late for the party", as your SSJS has already finished executing, when the content of your Google Sheet is returned to the page.
I will ...
TL;DR - just because code works in one browser and not the others does not mean you don’t have syntax errors.
I had 3 lines of code that were duplicate and looking for the wrong cookie for a lookup.
In Chrome and Safari it threw the exception, in FireFox it didn’t.
From the docs:
Provides a way for users to reference a CloudPages URL in an account from an email message
CloudPagesURL has to be used from within an email. The point is to encrypt ...