Closed wtpalexander closed 3 years ago
@wtpalexander thanks for the feedback! Assigning to @rosalyntan who is on call for emulator issues this week.
No worries, wish I could take a look and contribute myself but my TypeScript/JavaScript is quite limited still 🙃.
Thanks for filing this! I've filed b/177915972 for internal tracking.
The Auth Emulator will skip importing if the files don't exist and I think we should totally add more logging when that happens.
But for now though, a good way to debug is to make sure ./emulator-data/
exists and has auth_export
on the CI. Have you tried adding ls ./emulator-data/auth_export
before the emulator exec command? This may sound trivial, but sometimes it's a matter of relative paths / current directory, and other times it may be a matter of uploading the files to git and the right paths on CI.
Hi @wtpalexander,
Thanks for bringing up this issue. Could you please check the tips mentioned by @yuchenshi above? Nonetheless, I've added more logging in Fix #3066 for when the auth import directory is invalid.
@ssbushi & @yuchenshi, thanks for looking into this.
Running ls ./emulator-data/auth_export
before firebase emulators:exec "./XCodeTest.sh" --import=./emulator-data/
yields the following:
accounts.json
config.json
So looks like the files are there available to Firebase when running on CI.
Thanks for the prompt response @wtpalexander.
This is interesting. Is it possible for you to share a minimal-working-example version of your XCodeTest.sh
for us to reproduce this issue?
I've tried the same exec command and listed the accounts created using HTTP GET on http://localhost:9099/identitytoolkit.googleapis.com/v1/projects/my-awesome-project/accounts:query
. I did not run into the issue that you're highlighting and I want to see what's going wrong.
Thanks!
@ssbushi
My XCodeTest.sh
is as follows:
xcodebuild test \
-workspace ../MyAwesomeProject.xcworkspace \
-scheme MyAwesomeProject \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 11 Pro,OS=14.3' \
| xcpretty && exit ${PIPESTATUS[0]}
Supplying a sample project is a little harder since it requires a fully built app that has a UI test that runs through the log in flow, using the account already created in the emulator-data
export. Strangely enough the identical command does import the Auth Data when run locally. I've also noticed the Firestore Data is not imported either on CI, whereas it is when run locally. Given the file exists, the only difference I can think of is that Firebase is authenticated locally, but not remotely. Is there a requirement to be authenticated to allow data to import?
Thanks @wtpalexander.
Supplying a sample project is a little harder ...
I understand, no worries then. Nonetheless, authentication should not affect data import in the emulator.
Could you please try one of these suggestions:
firebase
version mismatch. Please try updating the firebase
binary on your CI to the latest version and run firebase -V
to ensure the versions match both locally and on CI.curl -H "Authorization: Bearer owner" -H "Content-Type: application/json" -X POST -d '{}' http://localhost:9099/identitytoolkit.googleapis.com/v1/projects/<your-project-id>/accounts:query
. Run this on CI, using firebase emulators:exec
with the import flag. This should list all accounts imported into the Auth Emulator. Please change the port number to the appropriate one if needed.Hope that helps!
@ssbushi, You've hit the nail on the head - I had 8.1 on CI and 9.2.2 locally. Silly me! Running on CI now successfully imports the Auth Data. Thanks so much for helping me find that issue, had me stumped for a while.
[REQUIRED] Environment info
firebase-tools: 9.1.0
Platform: macOS
[REQUIRED] Test case
[REQUIRED] Steps to reproduce
Attempt to use the accounts listed in the
auth_export/accounts.json
when running in CI but notice that these accounts don't exist and there are no logs stated the auth emulator imported its data, unlike when the emulators are started locally withfirebase emulators:start --import=./emulator-data/
.[REQUIRED] Expected behavior
Expect to have the accounts within
auth_export/accounts.json
accessible when CI runs usingemulators:exec
rather thanemulators:start
.[REQUIRED] Actual behavior