markupguy

markupguy

Shopify Phoenix iFrame app document head stripped out

Hey Everyone,

Having a whale of a time with getting my Shopify Phoenix app’s CSS to render.

Auth is sorted and the HTML renders fine, however, the entire document head is stripped out (and therefore the CSS with it).

I’ve added Content-Security-Policy frame-ancestors to allow https://.shopify.com https://.myshopify.com.

Shout out to @ericdude4 for making the setup pretty smooth with Shopifex :slight_smile: but now, the dang CSS!

Does anyone have an idea off the top of your head what could be going wrong?

Marked As Solved

markupguy

markupguy

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)

Also Liked

ericdude4

ericdude4

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.

zachallaun

zachallaun

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.

markupguy

markupguy

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 :smiley:

PS: Merry Christmas!

Where Next?

Popular in Questions Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 42920 311
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43622 214
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New

We're in Beta

About us Mission Statement