I get an error when using firebase

You will get an error like this.
The XMLHttpRequest compatibility library was not found.

I looked around but could not find a solution.
It seems that the problem is not caused by any specific code, but by communication with firebase.

I'm not sure if this is the right place to ask this, but do you know if this error is caused by the Quarkly environment?

Could you send the code example, we need to check our fix.

import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/functions';
import 'firebase/storage';

const firebaseConfig = {
   config data
}

firebase.initializeApp(firebaseConfig)

// It works fine up to the initialization of the user, but an error occurs when retrieving the user as shown in the code below.

firebase.auth().onAuthStateChanged((user) => {
  error
   ...
})

We fixed the bug, could you check if it repeats for you

Thank you for your prompt response. It worked fine.

I'm talking about another library, but this one also has an error and cannot be used.
For some reason, even though I'm importing the browser specification, I get an error that Buffer is not defined.

Error: Buffer is not defined

import { nanoid } from 'nanoid'
const id = nanoid()

In current version, we don’t support the directive "browser" in package.json for your case we recommends use like this:

import { nanoid } from 'nanoid/index.browser'
const id = nanoid()

or

import { nanoid } from 'nanoid/nanoid'
const id = nanoid()

It worked. Thank you for your support.

1 Like