Skip to content

Commit 70e6254

Browse files
authored
Update demo app README with troubleshooting steps (#6003)
1 parent 41549bb commit 70e6254

File tree

1 file changed

+84
-3
lines changed

1 file changed

+84
-3
lines changed

packages/auth/demo/README.md

+84-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Firebase-Auth for web - Auth Demo (Auth Next)
22

3-
## Prerequisite
3+
## Prerequisites
4+
5+
You need all the prerequisites mentioned in the [top-level README.](https://github.com/firebase/firebase-js-sdk#prerequisites)
46

57
You need to have created a Firebase Project in the
68
[Firebase Console](https://firebase.google.com/console/) as well as configured a web app.
@@ -36,14 +38,14 @@ Copy `src/sample-config.js` to `src/config.js`:
3638
cp src/sample-config.js src/config.js
3739
```
3840

39-
Then copy and paste the Web snippet config found in the console (either by clicking "Add Firebase to
40-
your web app" button in your Project overview, or clicking the "Web setup" button in the Auth page)
41+
Then copy and paste the Web snippet config found in the console (Project Settings -> Your apps -> SDK setup and Configuration)
4142
in the `config.js` file.
4243

4344
## Deploy
4445

4546
Before deploying, you may need to build the auth package:
4647
```bash
48+
yarn
4749
yarn build:deps
4850
```
4951

@@ -58,6 +60,20 @@ yarn run demo
5860
This will compile all the files needed to run Firebase Auth, and start a Firebase server locally at
5961
[http://localhost:5000](http://localhost:5000).
6062

63+
The demo opens a page like this:
64+
65+
![image](https://user-images.githubusercontent.com/35932340/153662957-41ba6a82-ea15-4084-ad3a-9fd41083efd3.png)
66+
67+
68+
This is a developer view of all the supported auth flows. Make sure that the auth flow you are testing is already enabled in your firebase project.
69+
For example, if you are testing “Sign up with email/password”, your project should allow email/password as a provider.
70+
If not, you will see an “auth/operation-not-allowed” error message.
71+
72+
You can check the enabled providers on the firebase console.
73+
74+
![image](https://user-images.githubusercontent.com/35932340/153662750-c0faf417-07b4-4f0e-93ab-5e0b82e3c793.png)
75+
76+
6177
## Running against Auth Emulator
6278

6379
The demo page by default runs against the actual Auth Backend. To run against the Auth Emulator with mocked endpoints, do the following:
@@ -74,3 +90,68 @@ The demo page by default runs against the actual Auth Backend. To run against th
7490
yarn run demo:emulator
7591
```
7692

93+
## Running against local changes to auth package
94+
95+
By default, the demo runs against the latest release of firebase-auth sdk. This can be modified by:
96+
97+
```
98+
// packages/auth/demo/package.json
99+
+ "@firebase/auth": "file:..",
100+
- "@firebase/auth": "0.18.0",
101+
```
102+
103+
## Troubleshooting
104+
105+
### Errors about dependency not being installed, example `lerna: command not found`
106+
107+
Ensure that you run `yarn` to install dependencies.
108+
109+
### `Failed to get Firebase project <project name>. Please make sure the project exists and your account has permission to access it.`
110+
111+
Logout, re-login and launch the demo
112+
113+
```bash
114+
firebase logout && firebase login && yarn demo
115+
```
116+
117+
### `Failed to list firebase projects` when running `firebase use --add`
118+
119+
Logout, re-login and add the project.
120+
121+
```bash
122+
firebase logout && firebase login && firebase use --add
123+
```
124+
125+
### `Access to localhost was denied` when accessing the demo app via http://localhost:5000
126+
127+
Most likely this means a different process is binding to localhost:5000.
128+
You can access the demo app via http://127.0.0.1:5000 or use a different port using `yarn demo --port 5002`
129+
130+
Note - If you use 127.0.0.1 in your browser, you need to allowlist it as a domain for sign in, as shown below.
131+
132+
![image](https://user-images.githubusercontent.com/35932340/153659058-d669055f-b587-4bc2-9f32-323149df50c3.png)
133+
134+
### `hosting: Port 5000 is not open on localhost, could not start Hosting Emulator.`
135+
136+
This can happen when you run `yarn run demo:emulator` if port 5000 is taken.
137+
Modify auth/demo/firebase.json with a custom port. Pick any port, this example picks 5091.
138+
139+
```
140+
{
141+
//...
142+
"emulators": {
143+
"hosting": {
144+
"host": "",
145+
"port": "5091"
146+
}
147+
}
148+
}
149+
```
150+
151+
### Error message about functions
152+
153+
`The Cloud Functions emulator requires the module "firebase-admin" to be installed. This package is in your package.json, but it's not available. You probably need to run "npm install" in your functions directory.
154+
i functions: Your functions could not be parsed due to an issue with your node_modules (see above)
155+
`
156+
157+
Run `npm install` inside the auth/demo/functions directory as mentioned in the error message.

0 commit comments

Comments
 (0)