0

I am using a simple redirect operation after writing some data into data extension

function main() {
    try {
        var response = processGoogleCaptcha();
        var captcha = new CaptchaResponse(response.success);
        if (captcha.success == true) {
            // writeFormData('Register_interest');
            Redirect("https://pub.s7.exacttarget.com/xxxx/", true);
        } else {
            var error_result = "Google Captcha auth failed!";
            sendMessage(error_result);
        }
    } catch (e) {
        var error = Platform.Function.Stringify(e);
        sendMessage(error);
        Redirect("https://pub.s7.exacttarget.com/xxxx/", true);
    }
}
main();

I get the following error:

{
    "message": "Error in the application.",
    "description": "ExactTarget.OMM.AMPScriptRedirectException: Error in the application. - from Jint\r\n\r\n"
}

I am not using a single line of AMPScript in my code.

Does anyone know what the error could be from?

  • can you give the full context? I believe @Rain might be right and its as simple as not loading the Core library – Gortonington Dec 20 '19 at 15:25
  • I am loading Platform.Load("core", "1.1.1"); at the top of my script properly but I use a set of function to do some stuff and then I call them out in the "main" function. Redirect to error page works good. Edited the question to give more context – jclobro Dec 20 '19 at 15:32
  • Have you verified it works without the Redirects listed? I get the feeling the error resides inside the syntax of your other code or similar issue in one of your other functions - if the page loads fine and you declared the core library. – Gortonington Dec 20 '19 at 15:48
  • 1
    Very good point @Gortonington - Redirect works just find on it's own... Seems the problem lies within one of other functions. Thanks – jclobro Dec 20 '19 at 16:07
4

How are you referencing to these CloudPages? If it's via CloudPagesURL, then this would be AMPscript. Also make sure the CloudPages are available in the same BU.

Additionally, double check that you have the proper syntax in place, including loading the core library:

<script runat="server" language="javascript">
Platform.Load("core", "1.1.1");

try {
    Redirect("http://page1.com",true);
 } 
 catch(e) {
    Redirect("http://page2.com",true);
} 
 </script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.