At the end I found the solution admin should be initialized with admin.initializeApp, better if as global