2 image instances are created in the image table

When I create a post with some text and an image. 2 image instances are created in the image table. First of all, I uploaded an image file on the server using curl, then the response of this curl request added to the post ->image field
Here is the curl request that is used to create the post:

await RNFetchBlob.fetch(
              Accept: 'application/json',
              'Content-Type': 'multipart/form-data',
              Authorization : "Authorization_Token" ,
              'hypi-domain': 'hotspotz-v3.hotspotz.hotspotz.hotspotz.hypi.app',

Then the response of this curl request I pass in gql query:

const imageObj = {
               name: imgResponse.name,
                   name: imgResponse.name,
                   directory: imgResponse.directory,
                   path: imgResponse.path,
                   isDirectory: imgResponse.isDirectory,
                   url: { path: imgResponse.url.path }
             img : imageObj,
             description : desc,
             userId : userId,

This is my query:

 mutation CreatePost($description: String ,$userId: ID!, $img:ImageInputOpt ) {
      values: {
        Post: [
            description: $description
            createdBy: {user: {hypi: {id: $userId}}}
    ) {

You need to provide hypi.id - it has no way of knowing that the Image already exists, please see below:

const imageObj = {hypi: {id: $imgResponse.hypi.id}}

That is all you need. You don’t need the other fields. It will connect the image to the post.

Here is a sample where I uploaded an image and did a screenshot to show you:

The file uploaded is called schema.txt so in the response, the hypi id is under obj['schema.txt'].hypi.id