TypeError: getCurves is not a function

Viewed 1255

I am trying to give custom claims to certain users for my react web app and I couldn't get past this error.

Error:

TypeError: getCurves is not a function
./node_modules/jose/lib/registry/ec_curves.js
  2 | 
  3 | const curves = new Set()
  4 | 
> 5 | if (getCurves().includes('prime256v1')) {
  6 |   curves.add('P-256')
  7 | }
  8 | 

and this is the function the function which triggers it

admin.auth().setCustomUserClaims(uid, {
  admin: true,
})

this is how my admin sdk looks like

import * as admin from 'firebase-admin';

import serviceAccount from './Servicekey.json';

admin.initializeApp({
    credential: admin.credential.cert(serviceAccount),
    databaseURL: <databaseURL>
});

export default admin;

I used to update user profile (password, email) in similar fashion from my system but cannot do that either.

2 Answers

In my case I used getToken() from next-auth

I know it's been a couple of months, but I just spent several days figuring this out, I ended up reverting to an older version of firebase-admin. Try reverting to version 9.0.0.

I reverted by going to the package.json file and changing the firebase-admin version to 9.0.0 then running "npm i".

Related