Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entering to my app hosted on firebase hosting redirects to google login page

Was tweaking with Server Side Rendering and google cloud functions. Deployed everything on hosting and something really strange happens. When I enter my page, https://accounts.google.com page appears...

enter image description here

with some really long link:

https://accounts.google.com/signin/v2/identifier?
 service=ah&passive=true&continue=https%3A%2F%2Fappengine.google.com
  %2F_ah%2Fconflogin%3Fcontinue%3Dhttps%3A%2F%2Fus-central1-treebase-
   b21-d5.cloudfunctions.net%2Fssrapp%2F&flowName=GlifWebSignIn&flowEntry=
    ServiceLogin&hl=en-GB

What may cause this? How to fix it? Thanks!

index.js file responsible for SSR:

import React from 'react';
import { renderToString } from 'react-dom/server';
import express from 'express';
import App from './app/containers/App';
import functions from 'firebase-functions';

const app = express();

app.get('**', (req, res) => {
  const html = renderToString(<App />);
  res.set('Cache-Control', 'public, max-age=600, s-maxage=1200');
  res.send(`
    <!doctype html>
    <html lang="en">
      <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
      </head>

      <body>
        <div id="app">${html}</div>
        <div id="fb-root"></div>
        <script type="text/javascript" src="/main.30e39d69fe1ce70d8983.js"></script>
      </body>
    </html>
  `);
});

export const ssrapp = functions.https.onRequest(app);

firebase.json

{
  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "function": "ssrapp"
      }
    ]
  }
}
like image 468
Patrickkx Avatar asked Feb 19 '18 21:02

Patrickkx


People also ask

How do I change my firebase Hosting URL?

Scroll down in 'Manage Site' and create a new site, then deploy there. You can't change your domain, but you can change the host! You can make as many sites as you want.

How do I temporarily disable firebase Hosting?

Go to Firebase Console and select Hosting from the menu of the left. You will see the deployed project with a list of your historical actions like Deployed , disabled , etc. Only after you have disabled the site, the "three vertical dots" menu will be available for you to choose the action to delete the deployment.


1 Answers

If you are using HTTP functions to serve dynamic content for hosting, you must use us-central1

Source: https://firebase.google.com/docs/functions/locations#http_and_client-callable_functions

like image 150
Utwo Avatar answered Nov 11 '22 14:11

Utwo