Skip to content
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

tuple import broken #119

Closed
KlausVii opened this issue Aug 4, 2023 · 5 comments
Closed

tuple import broken #119

KlausVii opened this issue Aug 4, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@KlausVii
Copy link

KlausVii commented Aug 4, 2023

fga --version
fga version v`0.1.0-beta3` (commit: `3cef3a747f9bc3629d2fbbb49ca1466652e10f92`, date: `2023-08-01T18:14:38Z`)

Tuple import does not work because it does not accept --model-id or default to something.

Running without --model-id fails like this:

fga tuple import --store-id=01H6933TA1CCCVZTPYBPQJS0VF --file=fga_tuples.json  --server-url http://localhost:3070
Error: failed to import tuples due to ReadAuthorizationModel validation error for GET ReadAuthorizationModel with body {"code":"authorization_model_not_found","message":"Authorization Model '' not found"}
 with error code authorization_model_not_found error message: Authorization Model '' not found

Trying to provide a model id fails too:

fga tuple import --store-id=01H6933TA1CCCVZTPYBPQJS0VF --file=services/cypress/fga_tuples.json  --server-url http://localhost:3070 --model-id=id
Error: unknown flag: --model-id

tuple write works without --model-id, but also returns the unknown flag error if the flag is provided as opposed to how it is listed as an optional flag in the readme.

@aaguiarz
Copy link
Member

aaguiarz commented Aug 4, 2023

  • I could reproduce the issue about model-id not being accepted as flag, we'll fix it.
  • fga tuple import --store-id=<store-id> --file tuples.json should work, targeting the latest model. Make sure the store-id is valid by running fga store get --store-id= 01H6933TA1CCCVZTPYBPQJS0VF

@KlausVii
Copy link
Author

KlausVii commented Aug 7, 2023

Thanks for the reply! I still cannot get import to work:

> fga tuple import --store-id 01H6933TA1CCCVZTPYBPQJS0VF --file=test.json  --server-url http://localhost:3070
Error: failed to import tuples due to ReadAuthorizationModel validation error for GET ReadAuthorizationModel with body {"code":"authorization_model_not_found","message":"Authorization Model '' not found"}
 with error code authorization_model_not_found error message: Authorization Model '' not found
> fga store get --server-url http://localhost:3070 --store-id 01H6933TA1CCCVZTPYBPQJS0VF
{
  "created_at":"2023-07-26T12:34:51.846295Z",
  "id":"01H6933TA1CCCVZTPYBPQJS0VF",
  "name":"Pactio",
  "updated_at":"2023-07-26T12:34:51.846295Z"
}
> fga model list --store-id 01H6933TA1CCCVZTPYBPQJS0VF --server-url  http://localhost:3070
{
  "authorization_models": [
    {
      "id":"01H70CA5NYV0RNRPJ4HEZ9SR1K",
      "created_at":"2023-08-04T13:38:09Z"
    },
    {
      "id":"01H70C9FXHXG1RDKDKMQ4WT27D",
      "created_at":"2023-08-04T13:37:46Z"
    }
  ]
}

As you can see the store exists and has models. The cli is making a call to ReadAuthorizationModel with an empty string:

 {"grpc_service": "openfga.v1.OpenFGAService", "grpc_method": "ReadAuthorizationModel", "grpc_type": "unary", "request_id": "6249cba1-403e-469c-85f0-5330415384a3", "raw_request": {"store_id":"01H6933TA1CCCVZTPYBPQJS0VF","id":""}, "raw_response": {"authorization_model":null}, "peer.address": "127.0.0.1:59962", "store_id": "01H6933TA1CCCVZTPYBPQJS0VF", "grpc_code": 2001, "error": "rpc error: code = Code(2001) desc = Authorization Model '' not found"}

Why its making that call, I don't know.

@aaguiarz aaguiarz added the bug Something isn't working label Aug 7, 2023
@jpadilla
Copy link
Member

jpadilla commented Aug 8, 2023

@KlausVii any chance you can build from main and try this again? https://github.com/openfga/cli#building-from-source

@aaguiarz
Copy link
Member

@KlausVii This should be fixed in the last release, could you please confirm that it works for you?

Thanks

@KlausVii
Copy link
Author

@aaguiarz @jpadilla Just pulled and tested, seems to be working now. Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants