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

102
Vistas
SyntaxError: Unexpected identifier 'supabase'. Expected ';' after variable declaration

I am trying to delete a row from the database and when I load the page, the file throws an error saying SyntaxError: Unexpected identifier 'supabase'. Expected ';' after variable declaration.

Following is my function code:

window.deleteChap = async function deleteChap(x) {

  let chapid = chapids[x];

  Swal.fire({
    title: `Are you sure you want to delete the chapter? This action is irreversible.`,
    showCancelButton: true,
    confirmButtonText: 'Yes, delete it!',
  }).then((result) => {
    if (result.isConfirmed) {

      const { data, error } = await supabase.from('chapters').eq('id', chapid).delete();
      
      if (error) {
        erroralert(error.message);
      } else {
        successalert(`Chapter deleted successfully.`);
      }
    }
  })

}

The supabase client has already been initialised this way:

let supabase;
$.ajax({
    url: "/keys",
    success: async function( result ) {
  
        result = JSON.parse(result);
  
        supabase = createClient(result.link, result.anon_key);

  }});

The javascript file is linked to the html with <script defer src="/js/dnovelinfo.js" type="module"></script>

I am not sure why the error is being thrown, even when I haven't interacted with the page (the page was only reloaded to see latest changes)

about 4 years ago · Juan Pablo Isaza
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