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

332
Vistas
Firebase Real Time Database - CORS header ‘Access-Control-Allow-Origin’ missing

I've just set up a Firebase real time database with default configuration. I'm using JavaScript to import the Firebase SDK via CDN since I can't use npm for now.

I know several similar questions have been asked and this one in particular is close to the problem I'm facing presently but none of the solutions there seem to work. I've allowed domains, edited the database rules for public access and tried different browsers but the problem persists.

Here's my import code:

<script type="module">
    import {
        initializeApp
    } from "https://www.gstatic.com/firebasejs/9.6.11/firebase-app.js";

    import {
        getDatabase
    } from "https://XXXXX-default-rtdb.europe-west1.firebasedatabase.app"; //path to my db location

    const firebaseConfig = {
        apiKey: "XXXXXXXXXXXXXXX",
        authDomain: "XXXXX.firebaseapp.com",
        databaseURL: "https://XXXXX-default-rtdb.europe-west1.firebasedatabase.app", //path to my db
        projectId: "XXXXX",
        storageBucket: "XXXXX.appspot.com",
        messagingSenderId: "1111111111",
        appId: "1:1111111:web:XXXXXX"
    };

    const app = initializeApp(firebaseConfig);

    const database = getDatabase(app);
</script>

What could I be doing wrong?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This is wrong:

import {
    getDatabase
} from "https://XXXXX-default-rtdb.europe-west1.firebasedatabase.app"; //path to my db location

You can't import the API from the location of your database. You need to import the SDK from the CDN that it's on, similar to what you do for initializeApp right above it:

import {
    initializeApp
} from "https://www.gstatic.com/firebasejs/9.6.11/firebase-app.js";

So something like:

import {
    getDatabase
} from "https://www.gstatic.com/firebasejs/9.6.11/firebase-database.js";
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