firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.01k stars 929 forks source link

Emulators:exec Auth doesn't import data #3022

Closed wtpalexander closed 3 years ago

wtpalexander commented 3 years ago

[REQUIRED] Environment info

firebase-tools: 9.1.0

Platform: macOS

[REQUIRED] Test case

firebase emulators:start
# Create some test accounts

# On separate terminal
firebase emulators:export "./emulator-data/

# Running in CI
firebase emulators:exec "./XCodeTest.sh" --import=./emulator-data/

[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 with firebase emulators:start --import=./emulator-data/.

[REQUIRED] Expected behavior

Expect to have the accounts within auth_export/accounts.json accessible when CI runs using emulators:exec rather than emulators:start.

[REQUIRED] Actual behavior

[2021-01-12T17:03:54.893Z] > 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"]
[2021-01-12T17:03:54.914Z] FirebaseError: Failed to authenticate, have you run firebase login?
⚠  emulators: You are not currently authenticated so some features may not work correctly. Please run firebase login to authenticate the CLI. 
i  emulators: Starting emulators: auth, functions, firestore {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: auth, functions, firestore"}}
[2021-01-12T17:03:54.929Z] [hub] writing locator at /var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/hub-progression-2fa20.json
⚠  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: database, hosting, pubsub {"metadata":{"emulator":{"name":"functions"},"message":"The following emulators are not running, calls to these services from the Functions emulator will affect production: \u001b[1mdatabase, hosting, pubsub\u001b[22m"}}
✔  functions: Using node@12 from host. {"metadata":{"emulator":{"name":"functions"},"message":"Using node@12 from host."}}
[2021-01-12T17:03:54.954Z] defaultcredentials: no credential available.
⚠  functions: You are not signed in to the Firebase CLI. If you have authorized this machine using gcloud application-default credentials those may be discovered and used to access production services. {"metadata":{"emulator":{"name":"functions"},"message":"You are not signed in to the Firebase CLI. If you have authorized this machine using gcloud application-default credentials those may be discovered and used to access production services."}}
i  firestore: Importing data from /Users/vagrant/git/Firebase/emulator-data/firestore_export/firestore_export.overall_export_metadata {"metadata":{"emulator":{"name":"firestore"},"message":"Importing data from /Users/vagrant/git/Firebase/emulator-data/firestore_export/firestore_export.overall_export_metadata"}}
⚠  firestore: Did not find a Cloud Firestore rules file specified in a firebase.json config file. {"metadata":{"emulator":{"name":"firestore"},"message":"Did not find a Cloud Firestore rules file specified in a firebase.json config file."}}
⚠  firestore: The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration. {"metadata":{"emulator":{"name":"firestore"},"message":"The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration."}}
⚠  It appears you are running in a CI environment. You can avoid downloading the Firestore Emulator repeatedly by caching the /Users/vagrant/.cache/firebase/emulators directory. 
i  firestore: downloading cloud-firestore-emulator-v1.11.11.jar... {"metadata":{"emulator":{"name":"firestore"},"message":"downloading cloud-firestore-emulator-v1.11.11.jar..."}}
[2021-01-12T17:03:54.970Z] >>> [apiv2][query] GET https://storage.googleapis.com/firebase-preview-drop/emulator/cloud-firestore-emulator-v1.11.11.jar [none]
[2021-01-12T17:03:55.159Z] <<< [apiv2][status] GET https://firebase-public.firebaseio.com/cli.json 200
[2021-01-12T17:03:55.160Z] <<< [apiv2][body] GET https://firebase-public.firebaseio.com/cli.json {"cloudBuildErrorAfter":1594252800000,"cloudBuildWarnAfter":1590019200000,"defaultNode10After":1594252800000,"minVersion":"3.0.5","node8DeploysDisabledAfter":1613390400000,"node8RuntimeDisabledAfter":1615809600000,"node8WarnAfter":1600128000000}
[2021-01-12T17:03:55.242Z] <<< [apiv2][status] GET https://storage.googleapis.com/firebase-preview-drop/emulator/cloud-firestore-emulator-v1.11.11.jar 200
[2021-01-12T17:03:55.243Z] <<< [apiv2][body] GET https://storage.googleapis.com/firebase-preview-drop/emulator/cloud-firestore-emulator-v1.11.11.jar [stream]
[2021-01-12T17:03:57.938Z] Ignoring unsupported arg: projectId {"metadata":{"emulator":{"name":"firestore"},"message":"Ignoring unsupported arg: projectId"}}
[2021-01-12T17:03:57.939Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"firestore"},"message":"Ignoring unsupported arg: auto_download"}}
[2021-01-12T17:03:57.939Z] Starting Firestore Emulator with command {"binary":"java","args":["-Dgoogle.cloud_firestore.debug_log_level=FINE","-Duser.language=en","-jar","/Users/vagrant/.cache/firebase/emulators/cloud-firestore-emulator-v1.11.11.jar","--host","localhost","--port",8080,"--seed_from_export","/Users/vagrant/git/Firebase/emulator-data/firestore_export/firestore_export.overall_export_metadata","--functions_emulator","localhost:5001"],"optionalArgs":["port","webchannel_port","host","rules","functions_emulator","seed_from_export"],"joinArgs":false} {"metadata":{"emulator":{"name":"firestore"},"message":"Starting Firestore Emulator with command {\"binary\":\"java\",\"args\":[\"-Dgoogle.cloud_firestore.debug_log_level=FINE\",\"-Duser.language=en\",\"-jar\",\"/Users/vagrant/.cache/firebase/emulators/cloud-firestore-emulator-v1.11.11.jar\",\"--host\",\"localhost\",\"--port\",8080,\"--seed_from_export\",\"/Users/vagrant/git/Firebase/emulator-data/firestore_export/firestore_export.overall_export_metadata\",\"--functions_emulator\",\"localhost:5001\"],\"optionalArgs\":[\"port\",\"webchannel_port\",\"host\",\"rules\",\"functions_emulator\",\"seed_from_export\"],\"joinArgs\":false}"}}
i  firestore: Firestore Emulator logging to firestore-debug.log {"metadata":{"emulator":{"name":"firestore"},"message":"Firestore Emulator logging to \u001b[1mfirestore-debug.log\u001b[22m"}}
[2021-01-12T17:04:01.561Z] API endpoint: http:// {"metadata":{"emulator":{"name":"firestore"},"message":"API endpoint: http://"}}
[2021-01-12T17:04:01.562Z] localhost:8080
If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:
   export FIRESTORE_EMULATOR_HOST=localhost:8080
Dev App Server is now running.
 {"metadata":{"emulator":{"name":"firestore"},"message":"localhost:8080\nIf you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:\n\n   export FIRESTORE_EMULATOR_HOST=localhost:8080\n\nDev App Server is now running.\n\n"}}
i  functions: Watching "/Users/vagrant/git/Firebase/functions" for Cloud Functions... {"metadata":{"emulator":{"name":"functions"},"message":"Watching \"/Users/vagrant/git/Firebase/functions\" for Cloud Functions..."}}
[2021-01-12T17:04:05.994Z] [worker-pool] addWorker(~diagnostic~) {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] addWorker(~diagnostic~)"}}
[2021-01-12T17:04:05.995Z] [worker-pool] Adding worker with key ~diagnostic~, total=1 {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] Adding worker with key ~diagnostic~, total=1"}}
[2021-01-12T17:04:05.996Z] [worker-pool] submitWork(triggerId=) {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] submitWork(triggerId=)"}}
[2021-01-12T17:04:05.996Z] [worker-~diagnostic~-ffabb62b-dd9b-46ef-ad07-195b29bad347]: Assigning socketPath: /var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/fire_emu_2273.sock {"metadata":{"emulator":{"name":"functions"},"message":"[worker-~diagnostic~-ffabb62b-dd9b-46ef-ad07-195b29bad347]: Assigning socketPath: /var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/fire_emu_2273.sock"}}
[2021-01-12T17:04:05.997Z] [worker-~diagnostic~-ffabb62b-dd9b-46ef-ad07-195b29bad347]: BUSY {"metadata":{"emulator":{"name":"functions"},"message":"[worker-~diagnostic~-ffabb62b-dd9b-46ef-ad07-195b29bad347]: BUSY"}}
[2021-01-12T17:04:06.303Z] [runtime-status] [2273] Functions runtime initialized. {"cwd":"/Users/vagrant/git/Firebase/functions","node_version":"12.18.1"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] Functions runtime initialized. {\"cwd\":\"/Users/vagrant/git/Firebase/functions\",\"node_version\":\"12.18.1\"}"}}
[2021-01-12T17:04:06.306Z] [runtime-status] [2273] Disabled runtime features: undefined {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] Disabled runtime features: undefined"}}
[2021-01-12T17:04:06.308Z] [runtime-status] [2273] Resolved module firebase-admin {"declared":true,"installed":true,"version":"9.4.2","resolution":"/Users/vagrant/git/Firebase/functions/node_modules/firebase-admin/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] Resolved module firebase-admin {\"declared\":true,\"installed\":true,\"version\":\"9.4.2\",\"resolution\":\"/Users/vagrant/git/Firebase/functions/node_modules/firebase-admin/lib/index.js\"}"}}
[2021-01-12T17:04:06.310Z] [runtime-status] [2273] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.13.0","resolution":"/Users/vagrant/git/Firebase/functions/node_modules/firebase-functions/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.13.0\",\"resolution\":\"/Users/vagrant/git/Firebase/functions/node_modules/firebase-functions/lib/index.js\"}"}}
[2021-01-12T17:04:06.311Z] [runtime-status] [2273] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.13.0","resolution":"/Users/vagrant/git/Firebase/functions/node_modules/firebase-functions/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.13.0\",\"resolution\":\"/Users/vagrant/git/Firebase/functions/node_modules/firebase-functions/lib/index.js\"}"}}
[2021-01-12T17:04:06.313Z] [runtime-status] [2273] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"}] {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] Outgoing network have been stubbed. [{\"name\":\"http\",\"status\":\"mocked\"},{\"name\":\"http\",\"status\":\"mocked\"},{\"name\":\"https\",\"status\":\"mocked\"},{\"name\":\"https\",\"status\":\"mocked\"},{\"name\":\"net\",\"status\":\"mocked\"}]"}}
[2021-01-12T17:04:06.314Z] [runtime-status] [2273] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.13.0","resolution":"/Users/vagrant/git/Firebase/functions/node_modules/firebase-functions/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.13.0\",\"resolution\":\"/Users/vagrant/git/Firebase/functions/node_modules/firebase-functions/lib/index.js\"}"}}
[2021-01-12T17:04:06.371Z] [runtime-status] [2273] Checked functions.config() {"config":{}} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] Checked functions.config() {\"config\":{}}"}}
[2021-01-12T17:04:06.371Z] [runtime-status] [2273] firebase-functions has been stubbed. {"functionsResolution":{"declared":true,"installed":true,"version":"3.13.0","resolution":"/Users/vagrant/git/Firebase/functions/node_modules/firebase-functions/lib/index.js"}} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] firebase-functions has been stubbed. {\"functionsResolution\":{\"declared\":true,\"installed\":true,\"version\":\"3.13.0\",\"resolution\":\"/Users/vagrant/git/Firebase/functions/node_modules/firebase-functions/lib/index.js\"}}"}}
[2021-01-12T17:04:06.372Z] [runtime-status] [2273] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.13.0","resolution":"/Users/vagrant/git/Firebase/functions/node_modules/firebase-functions/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.13.0\",\"resolution\":\"/Users/vagrant/git/Firebase/functions/node_modules/firebase-functions/lib/index.js\"}"}}
[2021-01-12T17:04:06.373Z] [runtime-status] [2273] Resolved module firebase-admin {"declared":true,"installed":true,"version":"9.4.2","resolution":"/Users/vagrant/git/Firebase/functions/node_modules/firebase-admin/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] Resolved module firebase-admin {\"declared\":true,\"installed\":true,\"version\":\"9.4.2\",\"resolution\":\"/Users/vagrant/git/Firebase/functions/node_modules/firebase-admin/lib/index.js\"}"}}
[2021-01-12T17:04:06.374Z] [runtime-status] [2273] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.13.0","resolution":"/Users/vagrant/git/Firebase/functions/node_modules/firebase-functions/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.13.0\",\"resolution\":\"/Users/vagrant/git/Firebase/functions/node_modules/firebase-functions/lib/index.js\"}"}}
[2021-01-12T17:04:06.374Z] [runtime-status] [2273] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"9.4.2","resolution":"/Users/vagrant/git/Firebase/functions/node_modules/firebase-admin/lib/index.js"}} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] firebase-admin has been stubbed. {\"adminResolution\":{\"declared\":true,\"installed\":true,\"version\":\"9.4.2\",\"resolution\":\"/Users/vagrant/git/Firebase/functions/node_modules/firebase-admin/lib/index.js\"}}"}}
⚠  It looks like you're trying to access functions.config().firebase but there is no value there. You can learn more about setting up config here: https://firebase.google.com/docs/functions/local-emulator {"metadata":{"emulator":{"name":"functions"},"message":"It looks like you're trying to access functions.config().firebase but there is no value there. You can learn more about setting up config here: https://firebase.google.com/docs/functions/local-emulator"}}
[2021-01-12T17:04:06.378Z] [runtime-status] [2273] initializeApp(DEFAULT) {"databaseURL":"https://progression-2fa20.firebaseio.com","storageBucket":"progression-2fa20.appspot.com","projectId":"progression-2fa20"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] initializeApp(DEFAULT) {\"databaseURL\":\"https://progression-2fa20.firebaseio.com\",\"storageBucket\":\"progression-2fa20.appspot.com\",\"projectId\":\"progression-2fa20\"}"}}
[2021-01-12T17:04:06.429Z] [runtime-status] [2273] auth.setJwtVerificationEnabled(false) {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [2273] auth.setJwtVerificationEnabled(false)"}}
[2021-01-12T17:04:06.724Z] addFirestoreTrigger "{\"eventTrigger\":{\"resource\":\"projects/progression-2fa20/databases/(default)/documents/contactForm/{formID}\",\"eventType\":\"providers/cloud.firestore/eventTypes/document.create\",\"service\":\"firestore.googleapis.com\"}}"
[2021-01-12T17:04:06.725Z] >>> HTTP REQUEST PUT http://localhost:8080/emulator/v1/projects/progression-2fa20/triggers/notifyAdminsOfNewSupportRequest-0  
 {"eventTrigger":{"resource":"projects/progression-2fa20/databases/(default)/documents/contactForm/{formID}","eventType":"providers/cloud.firestore/eventTypes/document.create","service":"firestore.googleapis.com"}}
[2021-01-12T17:04:06.731Z] [worker-~diagnostic~-ffabb62b-dd9b-46ef-ad07-195b29bad347]: IDLE {"metadata":{"emulator":{"name":"functions"},"message":"[worker-~diagnostic~-ffabb62b-dd9b-46ef-ad07-195b29bad347]: IDLE"}}
[2021-01-12T17:04:06.819Z] Jan 12, 2021 5:04:06 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
 {"metadata":{"emulator":{"name":"firestore"},"message":"Jan 12, 2021 5:04:06 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n"}}
[2021-01-12T17:04:07.049Z] Jan 12, 2021 5:04:07 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.
 {"metadata":{"emulator":{"name":"firestore"},"message":"Jan 12, 2021 5:04:07 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected HTTP/2 connection.\n"}}
[2021-01-12T17:04:08.328Z] <<< HTTP RESPONSE 200 {"content-type":"application/json","content-length":"4"}
✔  functions[notifyAdminsOfNewSupportRequest]: firestore function initialized. {"metadata":{"emulator":{"name":"functions"},"message":"\u001b[1mfirestore\u001b[22m function initialized."}}
i  Running script: ./XCodeTest.sh 
[2021-01-12T17:04:08.337Z] Running ./XCodeTest.sh with environment {"ANDROID_NDK_VERSION":"r21","BITRISE_CERTIFICATE_URL":"[REDACTED]","BITRISE_CACHE_INCLUDE_PATHS":"\n/Users/vagrant/git/Pods -> /Users/vagrant/git/Podfile.lock\n","BITRISE_CACHE_EXCLUDE_PATHS":"\n\n","BITRISE_BUILD_STATUS":"0","ADDON_SHIP_API_URL":"[REDACTED]","ANDROID_HOME":"/usr/local/share/android-sdk","BITRISE_CERTIFICATE_PASSPHRASE":"","BITRISE_OSX_STACK_REV_ID":"v2020_12_09","SHELL":"/bin/zsh","BITRISE_GIT_BRANCH":"feature/create-more-onboarding-flow-ui-tests","BITRISE_DEFAULT_PROVISION_URL":"[REDACTED]","TMPDIR":"/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/","ADDON_SHIP_API_TOKEN":"[REDACTED]","BITRISE_BUILD_API_TOKEN":"[REDACTED]","BITRISE_BUILD_URL":"https://app.bitrise.io/build/3dda2c46a0d016fb","BITRISE_APP_TITLE":"progressionios","SSH_RSA_PRIVATE_KEY":"","ssh_rsa_private_key":"","ADDON_VDTESTING_API_URL":"[REDACTED]","ANDROID_SDK_ROOT":"/usr/local/share/android-sdk","BITRISE_GIT_MESSAGE":"Add UI test for the Log In Flow\n\n* Add LogIn Flow UI Test\r\n* Disable Analytics for UI Tests\r\n\r\nTo get a green build this will need the PR for the Firebase project to be merged in.","BITRISE_DEPLOY_DIR":"/Users/vagrant/deploy","BITRISE_TMP_DIR":"/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/tmp896393248","BITRISE_KEYCHAIN":"bitrise.keychain","BITRISE_LIBRARY_DIR":"/Users/vagrant/Library/MobileDevice/Provisioning Profiles","BITRISE_SOURCE_DIR":"/Users/vagrant/git","LC_ALL":"en_US.UTF-8","GIT_CLONE_COMMIT_COMMITER_NAME":"J. Doe (https://devcenter.bitrise.io/builds/setting-your-git-credentials-on-build-machines/)","DOTPROFILE_LOADED":"1","script_file_path":"","BITRISE_IO":"true","USER":"vagrant","BITRISEIO_GIT_BRANCH_DEST":"develop","HOMEBREW_NO_ANALYTICS":"1","ENVMAN_ENVSTORE_PATH":"/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/bitrise298820507/output_envstore.yml","BITRISE_CACHE_DIR":"/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/cache595334277","BITRISE_EXPORT_METHOD":"app-store","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.derWlZrosI/Listeners","HOMEBREW_NO_AUTO_UPDATE":"1","GIT_CLONE_COMMIT_MESSAGE_SUBJECT":"Merge commit '06979d06c3a9' into develop","BITRISE_SCHEME":"ProgressioniOS","BITRISE_TOOLS_FOLDER_PATH":"/Users/vagrant/bitrise/tools","BITRISE_SYM_ROOT":"/Users/vagrant/build","MATCH_KEYCHAIN_PASSWORD":"vagrant","BITRISE_PULL_REQUEST":"107","BITRISE_CACHE_API_URL":"[REDACTED]","BITRISE_STEP_DIR":"/Users/vagrant/stepdir","BITRISE_TEST_RESULT_DIR":"/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/test_results645703230/test_result592432051","HOST_NAME":"prd-veg-std-g-xcode-12-3-210112165654-QvPSgNTp8zU8w6yU4wfTrc","BITRISE_APP_SLUG":"e907b03d5732e65c","PATH":"/Users/vagrant/.cache/firebase/runtime:/Users/vagrant/.bitrise/tools:/Users/vagrant/.jenv/shims:/Users/vagrant/.rbenv/shims:/usr/local/bin:/usr/local/sbin:~/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/vagrant/.jenv/shims:/Users/vagrant/.rbenv/shims:/usr/local/sbin:/Users/vagrant/bin:/usr/local/opt/go/libexec/bin:/Users/vagrant/go/bin:/Users/vagrant/bitrise/tools/cmd-bridge/bin/osx:/opt/android-ndk:/usr/local/share/android-sdk/platform-tools:/usr/local/share/android-sdk/cmdline-tools/tools/bin:/usr/local/flutter/bin:/usr/local/flutter/.pub-cache/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:/Users/vagrant/.jenv/bin:/usr/local/opt/go/libexec/bin:/Users/vagrant/go/bin:/Users/vagrant/bitrise/tools/cmd-bridge/bin/osx:/opt/android-ndk:/usr/local/share/android-sdk/platform-tools:/usr/local/share/android-sdk/cmdline-tools/tools/bin:/usr/local/flutter/bin:/usr/local/flutter/.pub-cache/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:/Users/vagrant/.jenv/bin","GIT_REPOSITORY_URL":"git@bitbucket.org:appstrm/progressionios.git","BITRISE_GIT_COMMIT":"06979d06c3a9","BITRISE_TRIGGERED_WORKFLOW_TITLE":"primary","JENV_LOADED":"1","PWD":"/Users/vagrant/git/Firebase","BITRISEIO_STACK_ID":"osx-xcode-12.3.x","BITRISE_TEST_DEPLOY_DIR":"/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/test_results645703230","JAVA_HOME":"/Users/vagrant/.jenv/versions/1.8","PR":"true","LANG":"en_US.UTF-8","runner_bin":"/bin/bash","BITRISE_FOLDER_PATH":"/Users/vagrant/bitrise","BITRISE_STEP_SOURCE_DIR":"/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/bitrise298820507/step_src","ADDON_VDTESTING_API_TOKEN":"[REDACTED]","BITRISE_STEP_FORMATTED_OUTPUT_FILE_PATH":"/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/bitrise298820507/formatted_output.md","XPC_FLAGS":"0x0","content":"git clone git@bitbucket.org:appstrm/progressionFirebase Firebase\n\ncd Firebase/functions\nnpm install\n\ncd ..\nfirebase emulators:exec \"./XCodeTest.sh\" --import=./emulator-data/ --debug","BITRISE_PROFILE_DIR":"/Users/vagrant/profiles","BITRISE_STEP_DATA_FOLDER_PATH":"/Users/vagrant/bitrise/stepdata","GIT_CLONE_COMMIT_HASH":"de6c33bc9e7a5aff4318b89b582d0e51c68be2c9","RBENV_SHELL":"bash","BITRISE_KEYCHAIN_PASSWORD":"vagrant","XPC_SERVICE_NAME":"0","STEPLIB_BUILD_STATUS":"0","BITRISE_DEFAULT_CERTIFICATE_PASSPHRASE":"[REDACTED]","SHLVL":"5","HOME":"/Users/vagrant","PULL_REQUEST_ID":"107","LANGUAGE":"en_US.UTF-8","BITRISEIO_GIT_REPOSITORY_OWNER":"appstrm","BITRISE_DEFAULT_CERTIFICATE_URL":"[REDACTED]","GIT_CLONE_COMMIT_AUTHOR_NAME":"J. Doe (https://devcenter.bitrise.io/builds/setting-your-git-credentials-on-build-machines/)","GIT_CLONE_COMMIT_COMMITER_EMAIL":"please-set-your-email@bitrise.io","CI":"true","BITRISEIO_GIT_REPOSITORY_SLUG":"progressionios","LOGLEVEL":"info","GIT_CLONE_COMMIT_AUTHOR_EMAIL":"please-set-your-email@bitrise.io","DOTBASHPROFILE_LOADED":"1","LOGNAME":"vagrant","BITRISEIO_PULL_REQUEST_REPOSITORY_URL":"git@bitbucket.org:appstrm/progressionios.git","HOMEBREW_NO_INSTALL_CLEANUP":"1","JENV_SHELL":"bash","BITRISE_APP_URL":"https://app.bitrise.io/app/e907b03d5732e65c","BITRISE_BUILD_NUMBER":"472","GIT_CLONE_COMMIT_MESSAGE_BODY":"","BITRISE_OBJ_ROOT":"/Users/vagrant/bin","GOPATH":"/Users/vagrant/go","BITRISE_BUILD_TRIGGER_TIMESTAMP":"1610470900","BITRISE_PROVISION_URL":"[REDACTED]","is_debug":"no","ANDROID_NDK_HOME":"/opt/android-ndk/android-ndk-r21","working_dir":"/Users/vagrant/git","BITRISE_PROJECT_PATH":"ProgressioniOS.xcworkspace","DOT_BITRISE_PROFILE_LOADED":"1","BITRISE_TRIGGERED_WORKFLOW_ID":"primary","BITRISE_TOOLS_CMD_BRIDGE_PATH":"/usr/local/bin/cmd-bridge","DOTBASHRC_LOADED":"1","BITRISE_SECRET_FILTERING":"true","GIT_CLONE_COMMIT_COUNT":"215","BITRISE_BUILD_SLUG":"3dda2c46a0d016fb","_":"/usr/local/bin/firebase","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0","NODE":"/usr/local/bin/firebase","FIREPIT_VERSION":"1.1.0","DEBUG":"true","IS_FIREBASE_CLI":"true","GCLOUD_PROJECT":"progression-2fa20","FIRESTORE_EMULATOR_HOST":"localhost:8080","FIREBASE_FIRESTORE_EMULATOR_ADDRESS":"localhost:8080","FIREBASE_AUTH_EMULATOR_HOST":"localhost:9099","FIREBASE_EMULATOR_HUB":"localhost:4400","PKG_EXECPATH":"/usr/local/bin/firebase"}
    Skipping duplicate build file in Compile Sources build phase: /Users/vagrant/git/ProgressioniOS/Components/Navigation/OnboardingNavigator.swift (in target 'ProgressioniOS' from project 'ProgressioniOS')
samtstern commented 3 years ago

@wtpalexander thanks for the feedback! Assigning to @rosalyntan who is on call for emulator issues this week.

wtpalexander commented 3 years ago

No worries, wish I could take a look and contribute myself but my TypeScript/JavaScript is quite limited still 🙃.

rosalyntan commented 3 years ago

Thanks for filing this! I've filed b/177915972 for internal tracking.

yuchenshi commented 3 years ago

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.

ssbushi commented 3 years ago

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.

wtpalexander commented 3 years ago

@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.

ssbushi commented 3 years ago

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!

wtpalexander commented 3 years ago

@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?

ssbushi commented 3 years ago

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:

Hope that helps!

wtpalexander commented 3 years ago

@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.