Hey @markupguy! This looks really strange… I don’t think it will have anything to do with the CSP headers. Can you include a link to a git repo which reproduces the error? Maybe just whatever code you have here, with your app’s API secret key removed?
PS. Love to see Shopifex getting used! I am hoping to spend some time refactoring the library in the new year and improving the documentation.
Also happily using Shopifex in an internal app for our store.
I’ve been using Shopify’s Polaris library for styling along with Phoenix components. Been working out pretty well! I’ll look into how I have CSS stuff set up later.
Thanks for the reply @zachallaun and @ericdude4 appreciate it! It really is quite strange.
But good to know this isn’t somehow expected, hah.
@ericdude4 it’s a super vanilla Phoenix app (just wanted to get it working first), with the Shopifex added bits. I’ve redone it a few times thinking I made a mistake somewhere. I can add you to the repo if you like, as it’s a private repo (doing a thing for a friend). Any and all help is welcome
Everyone here, I just want to say @ericdude4 is an absolute legend, going way beyond what can sensibly be expected from anyone i.t.o helping a stranger.
His solution:
it turns out that new phoenix specifies the root layout in plug :put_root_layout, {MyappWeb.LayoutView, :root} which is in the :browser pipeline by default. Shopifex provides the :shopifex_browser pipeline which replicates the default :browser pipeline plus the plug(Shopifex.Plug.LoadInIframe) plug. This doesn’t include the newer :put_root_layout plug though, which is why your app wasn’t loading anything from lib/myapp_web/templates/layout/root.html.heex
(loadiniframe plug was my addition to remove x-frame-options which Eric has built in already)
Happy to help! We will need an update to the Shopifex readme to recommend folks simply add the Shopifex.Plug.LoadInIframe to their existing browser pipeline instead of using :shopifex_browser