# GraphQL is returning \[object Object\]

**URL:** <https://community.neo4j.com/t/graphql-is-returning-object-object/41377>\
**Category:** GraphQL & GRANDstack\
**Tags:** schema, javascript, graphql\
**Created:** [July 14, 2021, 5:29pm UTC](https://community.neo4j.com/t/graphql-is-returning-object-object/41377 "2021-07-14T17:29:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![savanah.m.barnes](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/savanah.m.barnes/32/3868_2.png) [@savanah.m.barnes](https://community.neo4j.com/u/savanah.m.barnes)\
**Post date:** [July 14, 2021, 5:29pm UTC](https://community.neo4j.com/t/graphql-is-returning-object-object/41377/1 "2021-07-14T17:29:36Z")

</div>

I am using R/Shiny with Apollo and the Neo4j GraphQL Library. I am inferring my schema using this:

```auto
const inferAugmentedSchema = driver => {
  return inferSchema(driver).then(result => {
    console.log(result.typeDefs)
    return makeAugmentedSchema({
      typeDefs: result.typeDefs
    });
  });
};

```

The schema point of interest is:

```auto
type Skill {
   _id: Long!
   name: String!
   projects_in_need_of: [Project] @relation(name: "IN_NEED_OF", direction: IN)
}
type Project {
   _id: Long!
   description: String
   name: String!
}

```

My query is:

```auto
execute_query = function(query) {
        result <- conn$exec(Query$new()$query('link', query)$link)
        flat_result <- result %>% fromJSON(flatten = F)
        print(flat_result)
        result.df <- as.data.frame(flat_result[[1]])
        print(result.df)
        output$table <- DT::renderDataTable({result.df}, rownames = TRUE, filter = 'top', selection = 'single', extensions = 'Buttons')
    }
    
    # Run a query
    execute_query('

    query SampleQuery {
    Skill{
        name
        projects_in_need_of{
            name
            description
        }
      }
    }
    ')

```

The code will return the name of the skill, then it will return skill.projects\_in\_need\_of instead of the name, and description. When it has a project to return, it returns [object Object]

I can't figure out if it is my query or not- I am new to this and using a template!

---

<div class="post-metadata">

**Author:** ![michael.hunger](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/michael.hunger/32/27377_2.png) [@michael.hunger](https://community.neo4j.com/u/michael.hunger)\
**Post date:** [July 15, 2021, 12:25pm UTC](https://community.neo4j.com/t/graphql-is-returning-object-object/41377/2 "2021-07-15T12:25:32Z")

</div>

Does the query work if you just use graphql-playground or graphiql?

If you're just starting out you should consider moving to neo4j/graphql which is the new, officially supported library

> **[GraphQL library](https://neo4j.com/product/graphql-library/)**
>
> Check out the Neo4j GraphQL Library, an extensible, low-code, open source GraphQL API library, designed to make application development simpler and faster.

---

<div class="post-metadata">

**Author:** ![savanah.m.barnes](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/savanah.m.barnes/32/3868_2.png) [@savanah.m.barnes](https://community.neo4j.com/u/savanah.m.barnes)\
**Post date:** [July 15, 2021, 3:21pm UTC](https://community.neo4j.com/t/graphql-is-returning-object-object/41377/3 "2021-07-15T15:21:46Z")

</div>

If I copy and paste the query into the GraphQL playground API, it works! It must be something in my code. I don't know why it's not returning to the application.

The organization and team I belong to is using this template so I cannot move to the neo4j/graphql

---

<div class="post-metadata">

**Author:** ![savanah.m.barnes](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/savanah.m.barnes/32/3868_2.png) [@savanah.m.barnes](https://community.neo4j.com/u/savanah.m.barnes)\
**Post date:** [July 19, 2021, 3:22pm UTC](https://community.neo4j.com/t/graphql-is-returning-object-object/41377/4 "2021-07-19T15:22:13Z")

</div>

I switched to the new driver and my query worked for two runs before it started returning the node object and not the attributes.

---

<div class="post-metadata">

**Author:** ![michael.hunger](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/michael.hunger/32/27377_2.png) [@michael.hunger](https://community.neo4j.com/u/michael.hunger)\
**Post date:** [August 19, 2021, 9:26pm UTC](https://community.neo4j.com/t/graphql-is-returning-object-object/41377/5 "2021-08-19T21:26:12Z")

</div>

Can you add some log messages in between, not sure if the library has logging? Or step debug through it?
