-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
question(createTestEnvFile): can't access SERVICE_ACCOUNT env var on CircleCI #23
Comments
Did you try the |
Ping - wondering version you were running and if you got a chance to try the |
I am running into the same problem. @prescottprue, I am able to run the tests locally. But at circleci, I am lost. This is the workaround I am following:
I am using the dev branch to do all the testing and keep master read only. This way I am able to avoid committing the json file to git and recover the structure of the json file |
The purpose is to actually assign the whole service account object as an environment variable string i.e.: export SERVICE_ACCOUNT="{ \"type\": "service-account", ... }" Thanks for posting what you are doing in the mean time |
@prescottprue I'm running into the same issue on Gitlab. I have the I converted the contents of Example from chrome dev tools:
I tested both with and without the escape characters but I'm still getting the following error.
Here's my
And finally the
|
@ralphsmith80 I am able to put the @orthodoc what you are doing should work fine, but if you assign the SERVICE_ACCOUNT environment variable to a string containing the service account object, that should also work |
@prescottprue I did try that. No dice. I believe this error is the most telling.
I'm not setting this value anywhere https://create-react-app.dev/docs/adding-custom-environment-variables#docsNav
I do have a dev environment in Gitlab which is where I'm testing this but I didn't seen anything about that in the docs or code. Is there a case where I did try defining |
@ralphsmith80 Interesting, thanks for the info. Can you confirm again which version you are using?
Something to note: by default, when calling |
@prescottprue I'm using version I did try setting the branch explicitly as you noted ( One thing I forgot to mention/question previously regarding how to set the
What does "make sure to wrap it in Is that still relevant. That's what lead me to try |
@ralphsmith80 What was meant by that is that some provider do not allow you to set an object to the value of an environment variable unless it is wrapped in " (i.e. a string). That isn't an issue for me on Gitlab, and since I believe that is what you are using, you should also be fine. Are you able to run the tests locally? Using the Other than that though, I am still kinda stumped as to why the variables wouldn't be getting picked up. Did you maybe mark them as "protected" in the variables page? That could be protecting your brach from accessing it maybe? |
@prescottprue bah! yes I meant It works fine locally with the
I did mark them as protected but my branches are also protected. I ran into that issue sometime back and it took me a while to find the documentation that a protected branch can only access protected variables. Also I'm using other environment variable to continuously deploy to firebase and that is working without issue. I just published a forked version of this package with a bit more logging to see what environment variables are coming in. I might have to iterate on that a bit to figure it out but using the redirect method ( Although if this first test doesn't work I'll probably try that out just to see if it does work as a fallback. |
While I'm working through this it looks like the expectation is that all values are expected to be present in the I only have the values noted from step 4 in the setup in the config file and checked into source control. The script is hitting this return path for every environment variable. What values are expected to be defined in the CI environment variables?
What files should be checked in to source?
|
Based on the last test I ran I see the I believe the following is the correct: Values expected to be defined in the CI environment variables:
Files that should be checked into source:
It past my bedtime so I'll have to continue testing this theory tomorrow. @prescottprue if you have definitive answers I appreciate know them. Also if this is the problem then I think the documentation could be cleared up a bit around this. |
@ralphsmith80 That may be the case Totally agree that the instructions should be more clear, and there should be more info about what not to check into src as you are saying. Thanks for continuing to try to debug, really hoping to solve this so other folks don't bump into the same thing. |
@prescottprue with those changes it looks like everything is working from the cypress-firebase side. I'm still having problems getting cypress to actually run. Would you mind sharing your After reviewing the cypress docs I added the following parts which partially addressed errors I was seeing.
This is the error I'm seeing now:
This is my
Note that I'm defining one docker image to use at the top. I'm going to try and use the cypress docker image just for the |
Here is the gitlab config from fireadmin, which is a project I created for managing Firebase projects as "environments" and copying data across different projects. A key piece is to use the cypress image for those tests so that you have all of the necessary dependencies for running Cypress. I personally also like to run I think it would be good to include that link and other Gitlab setup examples in the docs, so thanks for asking! Great to hear that things are working as expected now - still planning on updating the logic to fall back to other options if the value itself does not exist. |
* feat(core): add unit tests * fix(callFirestore): fix `get` action passing invalid arguments * fix(callRtdb): fix do not add project flag unless project is defined * fix(createTestEnvFile): improve fallbacks for loading variables config/environment - #23
* fix(cy.callRtdb): only add `-d` flag when data is an object * fix(cy.callFirestore): fixture path no longer stringified - #39 * feat(cy.callRtdb): fix writing a non object value with `set` - #60 * feat(tests): add tests for string value - #39 * feat(docs): add note to README about adding files to `.gitignore` - #23
* feat(core): switch to typescript - #47 * fix(callFirestore): fix `get` action passing invalid arguments * fix(callRtdb): fix do not add project flag unless project is defined * fix(createTestEnvFile): improve fallbacks for loading variables config/environment - #23 * feat(core): switch to yarn over npm for install + lock file * feat(core): separate utils which require node into `node-utils.ts` - #47 * fix(cy.callRtdb): only add `-d` flag when data is an object * fix(cy.callFirestore): fixture path no longer stringified - #39 * feat(cy.callRtdb): fix writing a non object value with `set` - #60 * feat(tests): add tests for string value - #39 * feat(docs): add note to README about adding files to `.gitignore` - #23 * feat(core): add unit tests
In This should handle the issue being described, but if anyone is still experiencing an issue, feel free to reach out. Thanks to all for the input! |
I've been trying to run cypress-firebase on CI, but keep getting this error:
I tried different things:
none of them works.
The text was updated successfully, but these errors were encountered: