如何忽略“firebase-admin 似乎已安装在不受支持的环境中."? [英] How to ignore 'firebase-admin appears to have been installed in an unsupported environment.'?

查看:21
本文介绍了如何忽略“firebase-admin 似乎已安装在不受支持的环境中."?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 firebase,并且正在为我的团队构建管理仪表板.仪表板用于向我们的平台添加所有用户都可以看到的内容.

I'm using firebase and I'm building an admin dashboard for my team. The dashboard is used to add content to our platform that all users will be able to see.

起初我使用 Firebase JS SDK 实现了它,并禁用了安全规则来测试它.到目前为止一切正常.然后,我尝试将仪表板移动到另一个带有用于 node.js 的 Firebase Admin SDK 的 vue.js 项目,该项目将在具有 ServiceAccount.json 凭据的安全机器上使用.

At first I implemented it using the Firebase JS SDK with the security rules disabled to test it. So far everything ok. Then I tried to move the dashboard to another vue.js project with the Firebase Admin SDK for node.js that will be used on secure machines with ServiceAccount.json credentials.

尽管在没有 vue.js 的情况下运行 node.js 项目工作正常,但 vue.js 项目显示以下警告,不适用于我的用例.然后不允许任何操作,我收到了一堆不同的错误.

Although, running a node.js project without vue.js works just fine, the vue.js project display the following warning that does not apply to my use case. No operations are then permitted and I receive a bunch of different errors.

有没有办法忽略此警告并使 Firebase Admin SDK 做出响应?我可以在本地实现一个 Node.js/Express 服务器来重定向请求,但如果我没有错过任何东西,这听起来像是在浪费时间吗?

Is there a way to ignore this warning and make Firebase Admin SDK respond? I can implement a Node.js / Express server locally to make redirect the request but if I don't miss anything this sounds like a waste of time?

======== WARNING! ========

firebase-admin appears to have been installed in an unsupported environment.
This package should only be used in server-side or backend Node.js environments, and should not be used in web browsers or other client-side environments.

Use the Firebase JS SDK for client-side Firebase integrations:

https://firebase.google.com/docs/web/setup

推荐答案

仅在服务器端 Node.js 环境中支持使用适用于 Node.js 的 Firebase Admin SDK.它在客户端 Node.js 或其他 JavaScript 环境中不受支持.

Using the Firebase Admin SDK for Node.js is only supported on server-side Node.js environments. It is not supported in client-side Node.js or other JavaScript environments.

如果您想将来自 Admin SDK 的功能公开到您的客户端,您必须将该功能封装在 API 端点中,无论是在您控制的服务器上,还是通过 Cloud Functions.

If you want to expose functionality from the Admin SDK into your client, you will have to wrap that functionality in an API endpoint, either on a server you control, or through Cloud Functions.

这篇关于如何忽略“firebase-admin 似乎已安装在不受支持的环境中."?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆