Error on saving actions

I am trying to save action after changing data but it throwing me this error.

Error!invalid Action.CurrentVersion: embedded message failed validation | caused by: invalid ActionVersion.SupportedTriggers: value must contain exactly 1 item(s)

before saving action

exports.onExecutePostLogin = async (event, api) => {
    const axios = require("axios");
    const app_metadata = event.user.app_metadata || {};
    if(event.connection.strategy === "google-oauth2" && event.stats && event.stats.logins_count === 1){
      api.user.setAppMetadata("number_of_identities",event.user.identities.length);
      await axios.post('https://b0d5-180-151-40-34.ngrok.io/api/adduser',{event,isSignup:true});
      return;
    }
    // new identity has been used 
    else if(app_metadata.number_of_identities + 1  === event.user.identities.length){
      api.user.setAppMetadata("number_of_identities",event.user.identities.length);
      await axios.post('https://b0d5-180-151-40-34.ngrok.io/api/adduser',{event,newProvider:true});
    }
    // we already sent the verification message but user have not verified it's email.
    if(event.connection.strategy === "auth0" && app_metadata["verification_email_sent"] && !event.user.email_verified){
      api.redirect.sendUserTo('https://b0d5-180-151-40-34.ngrok.io/please-verify-user');
  }
  // user has verified it's email so will our sync our changes in database.
  else if(event.connection.strategy === "auth0" && app_metadata["verification_email_sent"] && event.user.email_verified && !app_metadata["email_verfied_by_database"]){
    await axios.post('https://b0d5-180-151-40-34.ngrok.io/api/auth/email-verified-done',{event});
  }

};

exports.onExecutePostLogin = async (event, api) => {
  const axios = require("axios");
  const app_metadata = event.user.app_metadata || {};
  if(event.connection.strategy === "google-oauth2" && event.stats && event.stats.logins_count === 1){
    api.user.setAppMetadata("number_of_identities",event.user.identities.length);
    await axios.post('https://dd39-180-151-40-34.ngrok.io/api/adduser',{event,isSignup:true});
    return;
  }
  // new identity has been used 
  else if(app_metadata.number_of_identities + 1  === event.user.identities.length){
    api.user.setAppMetadata("number_of_identities",event.user.identities.length);
    await axios.post('https://dd39-180-151-40-34.ngrok.io/api/adduser',{event,newProvider:true});
  }
  // we already sent the verification message but user have not verified it's email.
  if(event.connection.strategy === "auth0" && app_metadata["verification_email_sent"] && !event.user.email_verified){
    api.redirect.sendUserTo('https://dd39-180-151-40-34.ngrok.io/please-verify-user');
  }
  // user has verified it's email so will our sync our changes in database.
  else if(event.connection.strategy === "auth0" && app_metadata["verification_email_sent"] && event.user.email_verified && !app_metadata["email_verfied_by_database"]){
    await axios.post('https://dd39-180-151-40-34.ngrok.io/api/auth/email-verified-done',{event});
  }

};

in-short I am only changing my ngrok URL in my code.

  • old version of the code was working perfectly
  • I tried to reload the tab.
  • even after logging out and logging in it is throwing the same error.
  • I also tried to save perfectly working code copied from action-history but it is still throwing the same error
1 Like

Hi @pranshushah,

I was able to deploy both of those sets of code successfully.

Can you please try to create a new custom action? Make sure to preserve the header info in the action(e.g. @param {Event} event etc.).

If the issue persists can you please DM me your tenant name?

1 Like

so I revert back to the old version save and tried to make changes into that version with the same code and now it’s working :rofl:

2 Likes

Hm…that is certainly odd. It could have been an issue with the browser cache, or something else. Hard to say.

If you are able to reliably repeat the issue please let me know and I will report it. Thanks!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.