Iframe Resizer Not Working With Embeded Questions

I am working on a project that involves both embedding dashboards and questions.

The IframeResizer solution works perfectly with dashboards, however, it fails with questions. It always resizes too small.


def iframe_url
  @iframe_url ||=
      payload = {
        resource: { question: 2 },
        params: { },
        exp: (Time.current + 10.minutes).to_i
      token = JWT.encode(payload, METABASE_SECRET_KEY)
      METABASE_SITE_URL + "/embed/question/#{token}#bordered=false&titled=false"

Linked to this HTML

<main class="content">
  <div class="row">
    <div class="col-md-12">
      <div id='iframe-wrapper'>
        <iframe id="metabase-frame" src="<%= @facade.iframe_url %>" onload="iFrameResize({}, this)"  frameborder="0" height='10' width="100%" allowtransparency ></iframe>

<%= javascript_pack_tag 'iframeResizer' %>

Will fail. If I change the URL to and resource to dashboards

 dashboard: { dashboard: 2 },
 METABASE_SITE_URL + "/embed/dashboard/#{token}#bordered=false&titled=false"

It works perfectly. I have tried various sizing options available in the IframeResizer library none of them work.

Is this a known issue? Does anyone have a suggested solution?

What version of metabase are you running?


Let me know if there is any other information I can provide that may be helpful :smiley: