Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

firebase serve --only hosting does not work offline #1040

Closed
samtstern opened this issue Nov 27, 2018 · 10 comments
Closed

firebase serve --only hosting does not work offline #1040

samtstern opened this issue Nov 27, 2018 · 10 comments
Assignees
Labels
polish Small feature requests type: feature request

Comments

@samtstern
Copy link
Contributor

Version info

6.1.0

Platform Information

OS X

Steps to reproduce

  1. Turn of WiFi
  2. Run firebase serve --only hosting in a configured project directory

Expected behavior

Run server while offline (train, airplane, etc)

Actual behavior

$ firebase serve --only hosting

Error: Server Error. getaddrinfo ENOTFOUND cloudresourcemanager.googleapis.com cloudresourcemanager.googleapis.com:443

Full logs:

[debug] [2018-11-27T17:35:10.113Z] ----------------------------------------------------------------------
[debug] [2018-11-27T17:35:10.114Z] Command:       /Users/samstern/.nvm/versions/node/v8.12.0/bin/node /Users/samstern/.nvm/versions/node/v8.12.0/bin/firebase serve --only hosting
[debug] [2018-11-27T17:35:10.114Z] CLI Version:   6.1.1
[debug] [2018-11-27T17:35:10.114Z] Platform:      darwin
[debug] [2018-11-27T17:35:10.114Z] Node Version:  v8.12.0
[debug] [2018-11-27T17:35:10.115Z] Time:          Tue Nov 27 2018 09:35:10 GMT-0800 (PST)
[debug] [2018-11-27T17:35:10.115Z] ----------------------------------------------------------------------
[debug] 
[debug] [2018-11-27T17:35:10.125Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2018-11-27T17:35:10.126Z] > authorizing via signed-in user
[debug] [2018-11-27T17:35:10.126Z] [iam] checking project fir-oss for permissions ["firebase.projects.get"]
[debug] [2018-11-27T17:35:10.127Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/fir-oss:testIamPermissions  

[debug] [2018-11-27T17:35:10.162Z] Error: getaddrinfo ENOTFOUND cloudresourcemanager.googleapis.com cloudresourcemanager.googleapis.com:443
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
[error] 
[error] Error: Server Error. getaddrinfo ENOTFOUND cloudresourcemanager.googleapis.com cloudresourcemanager.googleapis.com:443
[debug] [2018-11-27T17:35:19.533Z] ----------------------------------------------------------------------
[debug] [2018-11-27T17:35:19.535Z] Command:       /Users/samstern/.nvm/versions/node/v8.12.0/bin/node /Users/samstern/.nvm/versions/node/v8.12.0/bin/firebase serve --only hosting
[debug] [2018-11-27T17:35:19.535Z] CLI Version:   6.1.1
[debug] [2018-11-27T17:35:19.535Z] Platform:      darwin
[debug] [2018-11-27T17:35:19.535Z] Node Version:  v8.12.0
[debug] [2018-11-27T17:35:19.536Z] Time:          Tue Nov 27 2018 09:35:19 GMT-0800 (PST)
[debug] [2018-11-27T17:35:19.536Z] ----------------------------------------------------------------------
[debug] 
[debug] [2018-11-27T17:35:19.545Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2018-11-27T17:35:19.547Z] > authorizing via signed-in user
[debug] [2018-11-27T17:35:19.547Z] [iam] checking project fir-oss for permissions ["firebase.projects.get"]
[debug] [2018-11-27T17:35:19.549Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/fir-oss:testIamPermissions  

[debug] [2018-11-27T17:35:19.573Z] Error: getaddrinfo ENOTFOUND cloudresourcemanager.googleapis.com cloudresourcemanager.googleapis.com:443
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
[error] 
[error] Error: Server Error. getaddrinfo ENOTFOUND cloudresourcemanager.googleapis.com cloudresourcemanager.googleapis.com:443
@bkendall
Copy link
Contributor

Well, it's not a bug, AFAIK... I'm gonna take this as a feature request and pass it to @mbleigh...

@samtstern
Copy link
Contributor Author

@bkendall what are we checking with the Resource Manager API on each serve? I can understand how this might not work offline for first-run but I would expect it to work ~5seconds after running an online serve.

@mbleigh
Copy link
Contributor

mbleigh commented Nov 27, 2018

serve currently calls out to fetch the current project's web app config before starting up the server. I'd be amenable to making that a "logs a warning instead" thing.

@Memeriaj Memeriaj added the polish Small feature requests label Jan 9, 2019
@philipwalton
Copy link

Please make it possible to run a development server without an internet connection. I was not able to get any work done on my flight today because I couldn't start my local server.

@bkendall
Copy link
Contributor

We hear ya, @philipwalton - unfortunately, we have limited resources to address this at the moment. PRs are always welcome 😄

@philipwalton
Copy link

After looking around in the source a bit, I realized that this library just uses superstatic under the hood for hosting (which is released as its own, separate module), so if all you need is a local static file server with config that matches your Firebase hosting environment, you can just use superstatic on its own.

Bonus: it's just connect/express-style middleware, so it easy to extend if you need to!

@jewelcse
Copy link

asaaaaaaaaaaaaaaaaaaaaaaaaaa

@thisismydesign
Copy link

@philipwalton Could you show an example with superstatic?

@philipwalton
Copy link

Here's how I'm using this on my personal blog: https://github.com/philipwalton/blog/blob/21fde735815d7c3620ecfb0f5f1c81df9d94874f/tasks/utils/server.js#L16

@samtstern
Copy link
Contributor Author

You can run the hosting emulator offline using emulators:start so I am going to close this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
polish Small feature requests type: feature request
Projects
None yet
Development

No branches or pull requests

7 participants