1

I am trying to follow this youtube tutorial.

I am getting stuck at inserting the first piece of data. Ania demonstrates it at 20.46 as follows:

mutation insertGenres {
  action: insertreference_list(value: {label: "genre", value: "action"}) {
    value{
      value
    },
  }

When I try this, I get an error that says:

{
  "errors": [
    {
      "message": "Validation error of type FieldUndefined: Field 'insertreference_list' in type 'Mutation' is undefined @ 'insertreference_list'",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "extensions": {
        "classification": "ValidationError"
      }
    }
  ]
}

When I google the error, a lot of responses tell people to use mutations instead of queries - but I've started from a mutation. I would like to know how to resolve the error, but I'd also like to find the skills to improve my search strategy for finding answers.

When I look at the documentation for using GraphQL with DataStax, I see a different format to the write structure, which is as follows:

insertbook(value: bookInput!, ifNotExists: Boolean, options: UpdateOptions): bookMutationResult

It has a colon and a fragment of text after it. It also explicitly states the ifNotExists: Boolean and options. I don't know if there may have been a change to how to use DataStax since the time Ania recorded the tutorial that means it is no longer a current demonstration of how to use the tool, or if there is an answer for this and I just haven't found it yet.

Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23
Mel
  • 2,481
  • 26
  • 113
  • 273
  • I found the problem. There is a red dot in the address bar on graphql that says it cant connect to the server. I don't know why - there are no details provided of why. I can see in Ania's video that she has the same error just before she tries to run the mutation, but I don't know what solves that error. – Mel Apr 03 '22 at 22:08

1 Answers1

0

You didn't provide details of how you've configured your Astra DB for Ania's Netflix Clone tutorial so I'm going to assume that you've named your keyspace as netflix.

It seems as though you haven't followed the instructions correctly and have missed steps. I can replicate the error you reported if I skip at least one of the steps in the tutorial.

In step 5 of the tutorial, you needed to do the following:

✅ In graphQL playground, change tab to now use graphql. Edit the end of the URl to change from system to the name of your keyspace: netflix

✅ Populate HTTP HEADER variable x-cassandra-token on the bottom of the page with your token as shown below (again !! yes this is not the same tab)

Switch tabs

In order to insert data, you need to switch to the graphql tab.

If you try to insert the data in the graphql-schema tab, you will get the error you reported.

Set keyspace

You need to update the URI of your GraphQL playground in the graphql tab to use the keyspace name netflix instead of system. For example:

https://db_id-us-west1.apps.astra.datastax.com/api/graphql/system

change to:

https://db_id-us-west1.apps.astra.datastax.com/api/graphql/netflix

If you try to insert data into the system keyspace, you will get the error you reported because the reference_list table does not exist in that keyspace. Cheers!

Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23
  • Thanks - I've followed all the steps in the video. I am in the netflix keyspace. I have double checked everything is as shown in the tutorial. Thanks for trying to help. I think I can take from your message that you don't think anything has changed since the time the video was recorded. That at least narrows the scope of things I need to try to investigate. thanks again – Mel Apr 03 '22 at 11:43
  • I have done the tutorial exactly as it appears, step by step, and I can confirm it works as advertised. Cheers! – Erick Ramirez Apr 03 '22 at 12:20
  • Thank you. I don't know why - I have been trying variations on this for days- each time trying a new authentication header key. This is about my 10th time trying and this time it worked. I don't understand why - but I'm moving on to minute 21. Thank you. – Mel Apr 14 '22 at 23:18