Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
load user.mail from Auth0 with async function

i want load the user.mail from Auth0 and safe there at a const. but I get a arrow. i don't see the error. can somebody help me to find the solution?

const userMailInfo = async () => {


 auth0Client = await auth.createClient();

  const result = await auth0Client.getUser().then(user => {
    console.log('mail', user.email);
    user.mail;
  });
  return result;
}

;(async () => {
  const users = await userMailInfo()
  console.log(users)
})()

i get follow error:

(node:19676) UnhandledPromiseRejectionWarning: ReferenceError: document is not defined
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It looks like these errors are caused by code running on the server-side, where they do not have access to 'document' and the like. In SvelteKit, endpoints always run on the server, and therefore do not have access to all the elements in the 'Client API'.

To guard code from running on the server side, try calling it through OnMount(). I've linked a Sapper issue outlining some similar solutions, e.g., using if(process.browser). I am not sure if this works in SvelteKit, but may be worth checking out.

Note: It seems like the error occured outside of the provided code snippet.


  • SvelteKit Discord Server contains some discussions on the topic, try searching for 'UnhandledPromiseRejectionWarning ReferenceError'.
  • (for Sapper) https://github.com/sveltejs/sapper/issues/1226
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda