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
Hello,
Could you please explain what you're seeing? I'm not really understanding your issue
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?
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.pngThis looks like what I need - thanks! FYI: the AI assistant wasn't able to find this doc.
I'm going to mark this thread as close. Feel free to reopen it by writing a message
Do you like this answer?
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?The web folder needs to be at the root of the project for it to work like I explained
Ahh, I misunderstood the reference to "root". I can see it working now right away. Thanks for your patience!
Do you like this answer?