Often times, you may want to use AMPScript in CloudPages to accomplish a business need. If there are AMPScript errors, the CloudPage will fail to load with a 500 error. Take the below as an example.
%%[
SET @VAR = lookup('test123', 'attribute', 'subscriberkey', _subscriberkey)
]%%
%%=v(@VAR)=%%
While this appears to be valid syntax, this AMPScript will cause your page to fail to load with '500 - Internal server error.'
The subscriber preview failed to generate. Review the details, correct all issues, and try again.
HTML Version
There is an error in your email. Please contact your customer service representative. Error 1: Script SET Statement Invalid<br>An error occurred when attempting to resolve a script expression.
See inner exception for detail. Script Expression: lookup('test123', 'attribute', 'subscriberkey', _subscriberkey) MemberID: 6400278 JobID: 0 The Data Extension name for a Lookup function call is invalid.
A Data Extension of this name does not exist. Data Extension Name: test123 Function Call: lookup('test123', 'attribute', 'subscriberkey', _subscriberkey) Parameter Name: DataExtensionName
Parameter Ordinal: 1 <br>Invalid Content: <br>SET @VAR = lookup('test123', 'attribute', 'subscriberkey', _subscriberkey)
From here, you can see that the Data Extension used in the Lookup() function does not exist. You can now correct this error and re-publish your CloudPage.
Note: Be aware of some AMPScript functions that only work in Email or CloudPages exclusively. These will have to be considered when performing the validation.
Example: InsertDE AMPScript can only be used in an email, but not in CloudPages. However, InsertData cannot be used in an email send, but can be used in CloudPages.
000383780

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.