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

Fix serve command #3989

Merged
merged 4 commits into from
Mar 31, 2018
Merged

Fix serve command #3989

merged 4 commits into from
Mar 31, 2018

Conversation

jonjamz
Copy link
Contributor

@jonjamz jonjamz commented Mar 11, 2018

From the Firebase docs, you must use --only in order to run the local function emulator.
See https://firebase.google.com/docs/functions/local-emulator

From the Firebase docs, you must use --only in order to run the local function emulator.
See https://firebase.google.com/docs/functions/local-emulator
Doesn't work without this
@timneutkens
Copy link
Member

@jthegedus

@jthegedus
Copy link
Contributor

@jonjamz Your fork is out of date. I've written comments about this not working and linked to relevant issues in the README - see current canary https://github.com/zeit/next.js/tree/canary/examples/with-firebase-hosting#run-firebase-locally-for-testing

I'll look at this again now and see if anything has changed.

@jthegedus
Copy link
Contributor

jthegedus commented Mar 12, 2018

Wow, the local function emulation actually works now! Cheers @jonjamz for bringing this to my attention 😄

Interestingly it still checks online to see if a Firebase project with that name exists within your account, but it certainly runs local functions with hosting rewrites. And it runs without having to have the Functions already deployed 💯 I may have spoke too soon. This does work, but may require a previous deployment.

@jonjamz Once you update to the latest canary the changes that need to occur are:

// package.json
+ "preserve": "npm run build-all",
- "serve": "echo \"for details see:\n\thttps://github.com/firebase/firebase-tools/issues/535 \n\thttps://github.com/zeit/next.js/issues/3167\";",
+ "serve": "NODE_ENV=production firebase serve --only functions,hosting",
+ "build-all": "npm run build-public && npm run build-funcs && npm run build-app && npm run copy-deps && npm run install-deps",

This would also close this #3167

@jonjamz
Copy link
Contributor Author

jonjamz commented Mar 12, 2018

Ha! I actually just did exactly what you did and came back here to write about it but you already had it figured out 😄. Glad it's all working!

@jthegedus
Copy link
Contributor

jthegedus commented Mar 12, 2018

@jonjamz You're still going to need to perform the update to the PR yourself, I don't have write access to your repo.

It is exciting though as this significantly reduces the turn around time from writing to testing.

You should also update the README.md as so

- Unfortunately I have been unable to get any combination of

- firebase serve --only functions,hosting
+ npm run serve

- to locally host the built Next.js app as expected. [This issue is where solutions are being explored](https://github.com/firebase/firebase-tools/issues/535) and they will be shared here and on the [Next.js repo's similar issue](https://github.com/zeit/next.js/issues/3167) when discovered.

@timneutkens timneutkens changed the base branch from master to canary March 31, 2018 13:54
@timneutkens timneutkens merged commit b39958e into vercel:canary Mar 31, 2018
@timneutkens
Copy link
Member

Fixed the suggestions you mentioned @jthegedus

@lock lock bot locked as resolved and limited conversation to collaborators Mar 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants