[BUGS ?] Workspace with FileStack credentials from another environment?

Hi,

We are working with images that are uploaded to FileStack using FileStack-js and FileStack-react with the credentials and security parameters to upload the files (apiKey, policy, signature), extracted from the workspace environment using the fileUploadInfo query:

{
  fileUploadInfo {
    policy
    signature
    apiKey
    path
  }
}

Then, when we make a mutation to our tables to incorporate the information from the image, we get the following error:

{
  "data": null,
  "errors": [
    {
      "message": "The argument is invalid",
      "locations": [
        {
          "line": 2,
          "column: 3
        }
      ],
      "path": [
        "fileCreate"
      ],
      "code": "InvalidArgumentError",
      "details": {
        "file": "File exists in another environment"
      }
    }
  ]
}

The value of fileId is obtained from the response given by the filestack-js client, and we try to make the mutation in 8base with:

mutation{
  fileCreate(data: {
    fileId: "<HANDLE OBTAINED>",
    filename: "<NAME>.jpg"
  }){
    go
    fileId
    downloadUrl
  }
}

At this point, we believe that the linked fileStack environment belongs to another workspace, since listing the existing images with the filesList query returns images that we have not uploaded in this project.

We need support about this to continue with the development. Thank you very much.
@alacret

Hi @leonellimap was this resolved?

I am also having this issue, getting the same error.

Any ideas @sebastian.scholl?

@jcollingj @sebastian.scholl
Yes, I found this solution: It was a missing property in the FileStack client settings. At first, I only used the parameters apiKey, policy and signature in the client initialization, and it did not work. But then I incorporated in the PickerOptions object the sub-object storeTo:

// FileStack client initialization

const clientOptions = {
   security: {
       policy: fileUploadInfo.policy,
       signature: fileUploadInfo.signature,
   },
};

const clientFileStack = filestack.init(
   fileUploadInfo.apiKey,
   clientOptions,
),

// Upload widget opening
const pickerOptions = {
   accept: 'image/jpeg',
   …
   storeTo: {path: fileUploadInfo.path}
 }
clientFileStack.picker(pickerOptions).open();

This way, I could have a correct connection to upload images.

1 Like

Yes.

Thank you @leonellimap! I ended up on the same path. Thank you for documenting the solution for future folks who land here.

@sebastian.scholl It could be worth pulling this into the documentation for working with filestack..