Using the filestack API documented here:
https://docs.8base.com/docs/development-tools/sdk/filestack-uploader
I am now able to upload files to filestack, get a response w/ the fileId and send it to 8base, it gets registered as a file correctly.
However, I have a trigger that runs on file create.after
, which makes a request to that .json file and tries to read it.
This fails with the following error:
2020-02-05T16:16:47.565Z 5f950e06-b4fe-45e7-9829-b42d4bd2db84 ERROR Invoke Error {"errorType":"FetchError","errorMessage":"invalid json response body at https://cdn.filestackcontent.com/security=p:xxxxxxxxx=,sxxxxxxx/xxxxxxxxseq1 reason: Unexpected number in JSON at position 1","message":"invalid json response body at
The json file when I uploaded it was pure valid json.
It was uploaded with 'Content-type': 'application/json'
However. When I go to see the file with the link. I see that FileStack has added some stuff at the top of the file. (not sure if this is the cause or not though).
Oddly when I upload a file directly through the app.8base UI it works fine.
So why are my JSON files being corrupted when using the filestack API?
Any ideas what’s going on here?