Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
106 views
in Technique[技术] by (71.8m points)

html - Adding Input Field doesn't allow me to use Firebase

!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <input id="process">
    <button onclick="Testing();">Testing</button>

        <!-- The core Firebase JS SDK is always required and must be listed first -->
    <script src="https://www.gstatic.com/firebasejs/8.2.4/firebase-app.js"></script>

    <!-- TODO: Add SDKs for Firebase products that you want to use
        https://firebase.google.com/docs/web/setup#available-libraries -->
    <script src="https://www.gstatic.com/firebasejs/8.2.4/firebase-database.js"></script>
    
    <script src="test.js"></script>


</body>
</html>

Adding the field as per above doesn't allow me to use firebase. The console log pops up the following issue:

provider.ts:108 Uncaught TypeError: Cannot read property 'FIREBASE_DATABASE_EMULATOR_HOST' of undefined
    at Yi.databaseFromApp (RepoManager.ts:141)
    at $.Ji.INTERNAL.registerComponent.X.setServiceProps.Reference [as instanceFactory] (index.ts:52)
    at R.getOrInitializeService (provider.ts:194)
    at R.getImmediate (provider.ts:95)
    at K._getService (firebaseApp.ts:126)
    at K.r.type.l.<computed> [as database] (firebaseNamespaceCore.ts:228)
    at Object.n [as database] (firebaseNamespaceCore.ts:209)
    at Testing (test.js:19)
    at HTMLButtonElement.onclick (test.html:11)

I have tried continuously to figure out what's the issue. Even the snippet above is me rewriting my code from scratch to pinpoint the exact issue. It seems that there is some incomaptibility with the field and firebase? However, I've seen other developers use the input field without any issues.

It's apparently the 'id' part of the code code that gives me the issue. I have no idea why.

Please advise.

question from:https://stackoverflow.com/questions/65915315/adding-input-field-doesnt-allow-me-to-use-firebase

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

After long hours of trial and error, the problem was that the id field could not be "process" because it is apparently a key word.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...