2017-11-19 132 views
1

firebaseに移行しようとしています。しかしその前に、私は次のものを実行することによってそれを少し試しました。私はこのコードを次の実行で発生している正常に追加および展開のクラウド機能を持っていますが、エラーにエラー403禁止されています。 URLにアクセスする権限がありません

Error: Forbidden

Your client does not have permission to get URL /app/lol from this server.

を取得しています:

const functions = require('firebase-functions'); 
const express = require('express'); 
const app = express() 
// tried adding this as middleware 
// const cors = require('core'({origin: true})) 
var admin = require('firebase-admin'); 

// app.use(cors) 
var serviceAccount = require("./ServiceAccount.json"); 

admin.initializeApp({ 
    credential: admin.credential.cert(serviceAccount), 
    databaseURL: "https://<my-app>.firebaseio.com/" 
}); 


app.get('/lol', (req, res) => { 
    res.send(`${Date.now()}`); 
}) 

exports.site = functions.https.onRequest(app); 

私firebase.jsonは以下の通りである:

{ 
    "database": { 
    "rules": "database.rules.json" 
    }, 
    "hosting": { 
    "public": "public", 
    "rewrites" :[{ 
     "source" : "**", 
     "function" : "app" 
     }], 
    "ignore": [ 
     "firebase.json", 
     "**/.*", 
     "**/node_modules/**" 
    ] 
    } 
} 

私はルートに行くと、それはGoogleの認証に、正しいアカウントを介して署名した後に私を必要とします。私はエラーが発生します。

ここで問題が発生します。解決する

答えて

0

2の代替の方法:

  1. あなたは

    0からfirebase.json を変更することができ

    exports.app = functions.https.onRequest(app); 
    
  2. exports.site = functions.https.onRequest(app); 
    

    を変更する必要があります

    "rewrites" :[{ 
        "source" : "**", 
        "function" : "site" 
    }], 
    
関連する問題