asiimov
asiimov2y ago

File not stored in DB!

Hello! I would like to ask for assistance regarding the issue I am currently facing right now with storing files into Convex's file storage. The following function shown in the picture opens an image picker in your phone and the user will be able to select one image and stores the image into the File Storage in Convex. But I get an error saying "Network request failed"
No description
5 Replies
asiimov
asiimovOP2y ago
The error:
No description
lee
lee2y ago
hi! you may be able to see the errors in the convex dashboard (npx convex dashboard) in the Logs tab. to help us troubleshoot, could you share your code for the endpoint /storeImage and the "Deployment URL" from dashboard settings? thanks
asiimov
asiimovOP2y ago
Here's the endpoint. Deployment URL: https://beaming-frog-8.convex.cloud Thank you for responding :>
No description
lee
lee2y ago
can you describe more about how your app works: is it React Native or served from a website or served from a convex HTTP action? Do you see the HTTP requests in dashboard logs? It looks like your 'Access-Control-Allow-Origin' header is saying the /storeImage endpoint can only be called from CONVEX_SITE, which probably isn't the origin for your app. check out the CORS description at https://docs.convex.dev/functions/http-actions#cors
HTTP Actions | Convex Developer Hub
HTTP actions allow you to build an HTTP API right in Convex!
sshader
sshader2y ago
I'd also make sure there's a route for OPTIONS + /storeImage. https://httptoolkit.com/will-it-cors/ is a pretty good walkthrough of CORS in general.
Will It CORS? - a CORS debugging tool that actually works.
Literally nobody understands CORS, except this one magic web page

Did you find this page helpful?