No public file access for Shopify embedded apps?

There doesn't appear to be public access to the web folder or any sub folders. Is this intentional for Shopify embedded apps? The AI assistant seems to think so. I'd like to host a few public images for transactional email templates without having to use another service.
10 Replies
Chocci_Milk
Chocci_Milk4w ago
Hello, Could you please explain what you're seeing? I'm not really understanding your issue
Elliott
ElliottOP4w ago
I want to make a few images available publicly that are stored inside of Gadget. Ideally, inside of the "web" folder; something like ~/web/email-image-assets/my-image-name-1.png. Links to these images will be referenced inside of transactional emails. Is this possible? When I try this now, I get an error saying "App can only be viewed in the Shopify Admin. If you are viewing this from the admin, try refreshing the page.". Is there a way for embedded Shopify app projects to allow select files or folders to be public?
Chocci_Milk
Chocci_Milk4w ago
If you want the image available publicly, why not use the public folder? https://docs.gadget.dev/guides/frontend/building-frontends#non-transformed-public-assets You would then access the image like: https://someApp--someEnv.gadget.app/imagePath/img.png
Elliott
ElliottOP4w ago
This looks like what I need - thanks! FYI: the AI assistant wasn't able to find this doc.
Chocci_Milk
Chocci_Milk4w ago
I'm going to mark this thread as close. Feel free to reopen it by writing a message
Gizmo
Gizmo4w ago
Do you like this answer? ​
Elliott
ElliottOP4w ago
Manually adding a public folder inside web didn't work initially; it wasn't publicly accessible outside of the Shopify embedded app. I had to add publicDir: 'web/public' to vite.config.mjs. Is this expected or should the manually created public folder just have worked initially?
Chocci_Milk
Chocci_Milk4w ago
The web folder needs to be at the root of the project for it to work like I explained
Elliott
ElliottOP4w ago
Ahh, I misunderstood the reference to "root". I can see it working now right away. Thanks for your patience!
Gizmo
Gizmo4w ago
Do you like this answer? ​

Did you find this page helpful?