Invalid file path

Hi Team,

I have created a 8base backend where i am having file as one of the field for a table.Here i am trying to upload file to filestack from 8base frontend and trying to get the handle id as a response from filestack and with that i am trying to store it in backend table by mutation.I have used filestack at the frontend custom code on file input onchange,

const options = {
storeTo: {
location: “S3”,
path: “production/cleij1gxy00p908jr2tws13oh/clftv5fn7009208mm66qn4pam/”,
},
security: {
signature: “95fed006f8fcb60f62832befdc57598c536bbc820a10c7844dbdb00a2947375c”,
policy: “eyJjYWxsIjpbInJlYWQiLCJwaWNrIiwic3RvcmUiLCJjb252ZXJ0Il0sImV4cGlyeSI6MTY4MDE5MTQyMiwicGF0aCI6InByb2R1Y3Rpb24vY2xlaWoxZ3h5MDBwOTA4anIydHdzMTNvaC9jbGZ0djVmbjcwMDkyMDhtbTY2cW40cGFtLyJ9”,
}
}
const client = filestack.init(“Abj6n4LZFRoS9eTRfPmWTz”,options)
client.upload(event.target.files[0]).then((res) => {
console.log(res)
imageSource.setValue(res.url)
})

after uploading this i am getting url as a response, but if am trying to copy that handle id from response and store it in backend eg:
mutation{
tableCreate(data:{
file:{
create:{
fileId:“handle id from frontend”
}
}
}){
}
}
this mutation throw me error saying that “Invalid file path”
I know that i have making mistakes in the upload options from frontend.I have configured the signature and policy and i dont know how to speciy the path which is given above.

Hi.

Quick flow description of uploading files to 8base.

  1. User asks the server give me credentials to upload the file
  2. Based on received credentials the user uploads the file according this documentation, Filestack | 8base Docs. “React Native Support” section or “Filestack API” sections
  3. Create object in 8base with file handle from the second step. (more description in the doc)

During creating object in 8base you should not specify path. The server resolves meta info based on file id from filestack. The error says that during resolving path from the file meta info, for some reason path is missing.
The problem is in the second step, how the file was uploaded to filestack, it’s hard to say how to fix it without investigation. Try to upload file according documentation from 2 step, please.

If it doesn’t help you, we will investigate this case.

Thanks!

1 Like