Realm user registration, confirmation custom function not working...?

This is odd… if I use “fetch” in my custom Atlas/Realm function, I get “fetch is not defined”. So, then I tried to install node-fetch module as dependency that crashed with an error…

Failed to install dependencies

failed to transpile node_modules/node-domexception/.history/index_20210527213843.js. “node-domexception” is likely not supported yet. unknown: Unexpected token (9:2)

How do I make the “custom registration confirmation function” work?

exports = async ({ token, tokenId, username }) => 
{
   var data = {
      token: token,
      tokenId: tokenId,
      email: username
   };
   data = JSON.stringify(data);
   try
   {
      const res = await fetch('https://api.x.co/user/register/confirm',
      {
         method: "POST",
         headers: {"Content-Type": "application/json", "From-Realm": "USER_REGISTRATION"},
         body: data
      });
      if (res.ok) 
      {         
         console.log("ControllerRegistration: sent confirmation tokens");
         return {status: "pending"};
      }
      else
      {
         return {status: "fail"};
      }
   }
   catch(e)
   {
      console.log("ControllerRegistration: error sending confirmation tokens - "+e.toString());
   }
   return {status: "fail"};
}

Well no answer but some insight to anyone trying to use Atlast as BAAS for user account management. I couldn’t get it working (post above) so unfortunately I’m bailing on using it at all (Realm). Not a Realm solution but it is an answer to the problem. If anyone gets something working for User confirm/etc, hopefully they see this post and give us some clues how to make it work. Clearly Mongo isn’t answering many posts. This is the second critical post I’ve posted and got no responses over past few months. I wanted to use Realm but we’re launching without it now…

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