Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Invalid value for [project] and failed to make bucket #1792

Closed
nicorichard opened this issue Apr 9, 2021 · 8 comments · Fixed by #1805, #1955 or #2060
Closed

Invalid value for [project] and failed to make bucket #1792

nicorichard opened this issue Apr 9, 2021 · 8 comments · Fixed by #1805, #1955 or #2060

Comments

@nicorichard
Copy link

Describe the bug

A clear and concise description of what the bug is.

I believe that Flank may be having trouble with our legacy project-id. Our project is very old and our Firebase ID is of the format company.com:appname. Does it seem as if Flank might not like our project ID as it contains a colon and a dot?

I've tried with the project number as well which gives the same error.

To Reproduce

Steps to reproduce the behavior:

Running $ flank android run gives

version: v21.04.0
revision: eb4ee0c932f609d843ab5353445876aa1273e332
session id: c6f4d030-12d9-4354-991f-66bc975edc08

Warning: Failed to make a bucket for 59732999025
Cause: You already own this bucket. Please select another name.

Invalid value for [project]: no argument value found

with flank.yml:

gcloud:
  results-bucket: "flank"
  timeout: "30m"
  app: "app/build/outputs/apk/stagingEspresso/debug/App-staging-espresso-debug.apk"
  test: "app/build/outputs/apk/androidTest/stagingEspresso/debug/App-staging-espresso-debug-androidTest.apk"
  device:
  - model: "NexusLowRes"
    version: "28"
    locale: "en"
    orientation: "portrait"
flank:
  project: "59732999025" # or "company.com:appname"

(the first time it was run, or if I delete the bucket, the warning does not appear)

Expected behavior

A clear and concise description of what you expected to happen.

I expect the tests to run, or to provide output that helps to solve the issue.
Also, I've noticed in the documentation yaml samples are references to "project name". This undoubtedly should be changed to project id, correct?

Details (please complete the following information):

Have you tested on the latest Flank snapshot?

Post the output of flank --version.

version: v21.04.0
revision: eb4ee0c932f609d843ab5353445876aa1273e332
session id: c6f4d030-12d9-4354-991f-66bc975edc08
@nicorichard nicorichard added the Bug label Apr 9, 2021
@pawelpasterz
Copy link
Contributor

pawelpasterz commented Apr 12, 2021

Hey! Thanks for reporting that issue!

Also, I've noticed in the documentation yaml samples are references to "project name". This undoubtedly should be changed to project id, correct?

You are absolutely right, tbh we have another issue open because of misleading documentation.

Does it seem as if Flank might not like our project ID as it contains a colon and a dot?

Flank does not process project_id in any way, it just passes it to the Google API client (as a string).

Flank fetches lists of buckets for given ID and searches for the one provided in configuration (results-bucket). For some reason, it is unable to find desired one (flank in your case) and tries to create a new one. We need to investigate why this is happening.

Do you see the same error when using gcloud? gcloud firebase test android run your_config.yml:gcloud?
Does you account (the one you are authenticating with flank) has list permission in your project?

@piotradamczyk5 piotradamczyk5 self-assigned this Apr 12, 2021
@piotradamczyk5
Copy link
Contributor

piotradamczyk5 commented Apr 12, 2021

@CityTransit @pawelpasterz
I tried to reproduce this issue with flank project number instead of project id, which worked fine.
Besides the steps proposed by @pawelpasterz
Could you also try to run it with passing project id/number as command-line argument using --project=<project id|project number>
Is there any way we could contact on slack to directly debug it? I could not find any project with a deprecated id, but I guess it could not be the main source of the issue

EDIT:
From my research, I think that you probably got issue 409, but then I do not know why you get Invalid value for [project]: no argument value found message 🤔

@nicorichard
Copy link
Author

Updated Flank to the latest and tried with the argument (both id and number) and received the same errors.

I installed gcloud cli and also received similar issues:

  • With the project under flank in the flank.yml: ERROR: (gcloud.firebase.test.android.run) No project specified. Please add --project PROJECT_ID to the command line or first run
  • With the project under gcloud in the flank.yml: ERROR: (gcloud.firebase.test.android.run) [project] is not a valid argument name for: gcloud test run.

But setting the project via the argument --project= worked for gcloud (this did not work for flank).
I then noticed I can set my project in the configuration like so: gcloud config set project company.com:appname. This actually worked for both gcloud and flank, and I am now running my tests.

The bit about "failed to make bucket" was a red herring I believe. I can delete the bucket and then I do not get this error for one run. Everything seems to write correctly either way.

@piotradamczyk5
Copy link
Contributor

@CityTransit
thank you for the update, so I guess that we should just update the documentation to use project id instead of the project name. Do you need any more support from the Flank team?

@mergify mergify bot closed this as completed in #1805 Apr 14, 2021
mergify bot pushed a commit that referenced this issue Apr 14, 2021
Fixes #1792 

These changes fix bad information that flank requires project name instead of project id
@nicorichard
Copy link
Author

Thanks for updating the documentation. I believe that we may still be some small issue somewhere, but we have a workaround to use in the meantime.

To anyone reading in the future, look to try gcloud config set project {project id} and/or add project = {project id} to your configuration file. Mine is located at~/.config/gcloud/configurations/config_default

@piotradamczyk5 piotradamczyk5 removed their assignment Apr 26, 2021
@adamfilipow92 adamfilipow92 self-assigned this May 19, 2021
@piotradamczyk5
Copy link
Contributor

@mergify mergify bot closed this as completed in #1955 May 24, 2021
mergify bot pushed a commit that referenced this issue May 24, 2021
Fixes #1792 #1831 

This pr contains changes requested in #1831 and may fix #1792. 

## Test Plan
> How do we know the code works?

1. Flank firstly should try to use credentials from env variable ```GOOGLE_APPLICATION_CREDENTIALS``` [here](https://github.com/Flank/flank/blob/c643f859e053dfdb890170a087d783c23eacbb11/test_runner/src/main/kotlin/ftl/client/google/Credentials.kt#L22)
1. If this method fails Flank should try to load credentials from ```./user_home/.flank``` directory [here](https://github.com/Flank/flank/blob/c643f859e053dfdb890170a087d783c23eacbb11/test_runner/src/main/kotlin/ftl/client/google/Credentials.kt#L26) or if it's windows from ```%USER_HOME%/.config/gcloud/application_default_credentials.json``` [here](https://github.com/Flank/flank/blob/c643f859e053dfdb890170a087d783c23eacbb11/test_runner/src/main/kotlin/ftl/client/google/Credentials.kt#L34)
@bootstraponline
Copy link
Contributor

Reopening based on user feedback that the issue is still occurring.
https://firebase-community.slack.com/archives/C72V6UW8M/p1625006503048800?thread_ts=1622152417.007600&cid=C72V6UW8M

@adamfilipow92
Copy link
Contributor

We have prepared a fix in this pr #2060

The problem occurs when Flank trying to send usage statistics. In this step Flank comparing default args and user-defined args to send args only changed by the user. When default android args returns null in project id Flank fails. We currently removed comparing with default args now everything should be fine.

# for free to join this conversation on GitHub. Already have an account? # to comment