question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v7.0.0-beta.3 throws Response has no matching <turbo-frame> on console

See original GitHub issue

I had a working sample that stopped after this v7.0.0-beta.3 release. I’m using the latest over CDN so I noticed.

If I change back to any prior v7.0.0-beta version my code works. On the v7.0.0-beta.3 I get:

Response has no matching <turbo-frame id="beverages_list"> element turbo.js:740:13
    extractForeignFrameElement https://cdn.skypack.dev/-/@hotwired/turbo@v7.0.0-beta.3-tvFsO8IW4m2YjmlcLZZq/dist=es2020/@hotwired/turbo.js:740
    loadResponse https://cdn.skypack.dev/-/@hotwired/turbo@v7.0.0-beta.3-tvFsO8IW4m2YjmlcLZZq/dist=es2020/@hotwired/turbo.js:641
    formSubmissionSucceededWithResponse https://cdn.skypack.dev/-/@hotwired/turbo@v7.0.0-beta.3-tvFsO8IW4m2YjmlcLZZq/dist=es2020/@hotwired/turbo.js:700
    requestSucceededWithResponse https://cdn.skypack.dev/-/@hotwired/turbo@v7.0.0-beta.3-tvFsO8IW4m2YjmlcLZZq/dist=es2020/@hotwired/turbo.js:483
    receive https://cdn.skypack.dev/-/@hotwired/turbo@v7.0.0-beta.3-tvFsO8IW4m2YjmlcLZZq/dist=es2020/@hotwired/turbo.js:351
    perform https://cdn.skypack.dev/-/@hotwired/turbo@v7.0.0-beta.3-tvFsO8IW4m2YjmlcLZZq/dist=es2020/@hotwired/turbo.js:337
    start https://cdn.skypack.dev/-/@hotwired/turbo@v7.0.0-beta.3-tvFsO8IW4m2YjmlcLZZq/dist=es2020/@hotwired/turbo.js:445
    formSubmissionIntercepted https://cdn.skypack.dev/-/@hotwired/turbo@v7.0.0-beta.3-tvFsO8IW4m2YjmlcLZZq/dist=es2020/@hotwired/turbo.js:669
    submitBubbled https://cdn.skypack.dev/-/@hotwired/turbo@v7.0.0-beta.3-tvFsO8IW4m2YjmlcLZZq/dist=es2020/@hotwired/turbo.js:538
    (Async: EventListener.handleEvent)
    start https://cdn.skypack.dev/-/@hotwired/turbo@v7.0.0-beta.3-tvFsO8IW4m2YjmlcLZZq/dist=es2020/@hotwired/turbo.js:546
    connect https://cdn.skypack.dev/-/@hotwired/turbo@v7.0.0-beta.3-tvFsO8IW4m2YjmlcLZZq/dist=es2020/@hotwired/turbo.js:606
    connectedCallback https://cdn.skypack.dev/-/@hotwired/turbo@v7.0.0-beta.3-tvFsO8IW4m2YjmlcLZZq/dist=es2020/@hotwired/turbo.js:55
    <anonymous> https://cdn.skypack.dev/-/@hotwired/turbo@v7.0.0-beta.3-tvFsO8IW4m2YjmlcLZZq/dist=es2020/@hotwired/turbo.js:931

I’m not sure if I’m doing something wrong (I followed https://turbo.hotwire.dev/handbook/streams) that I didn’t notice but I wanted to report early on.

My page looks like this:

<!-- omitted irrelevant stuff -->
<section>
    <h1>Showcase how to add to part of a page</h1>

    <turbo-frame id="beverages_list">
        <form action="/beverages/any" method="post">
            <button type="submit">Add beverage</button>
        </form>
        <div id="beverage_1"><p>1 - Coffee</p></div>
    </turbo-frame>

</section>

And my server response to the POST method is:

<!-- omitted irrelevant stuff -->
<body>
<h1>A Beverage (page or Turbo component)</h1>
<turbo-stream action="append" target="beverages_list">
    <template>
        <div id="beverage_8">
            <p>
                <span>8</span> - <span>Coffee</span>
            </p>
        </div>
    </template>
</turbo-stream>
</body>

_Originally posted by @brunodrugowick in https://github.com/hotwired/turbo/issues/31#issuecomment-761569577_

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
brunodrugowickcommented, Mar 13, 2021

@seb-jean and others having the same issue, this may help you.

I fixed my problem investigating and debugging another project.

But the “solution” is also stated on the documentation here. This was changed on this commit from Jan 18. And is mentioned on the beta-3 changelog on Jan 12.

I basically changed my content-type from text/html; turbo-stream to text/vnd.turbo-stream.html on my view resolver, which is required on v7.0.0-beta.3+:

@Bean
public ThymeleafViewResolver viewResolver(SpringTemplateEngine templateEngine) {
    ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();

    viewResolver.setContentType("text/html; turbo-stream");
    viewResolver.setCharacterEncoding(StandardCharsets.UTF_8.name());
    viewResolver.setOrder(0);
    viewResolver.setViewNames(new String[] { "*stream*" });
    viewResolver.setTemplateEngine(templateEngine);

    return viewResolver;
}

And everything works fine now.

Thanks! And remember, folks: RTFM. <-- also a note for myself 😆

0reactions
seb-jeancommented, Mar 10, 2021

I have the same issue :

Response has no matching <turbo-frame id="my_stuff"> element

Read more comments on GitHub >

github_iconTop Results From Across the Web

Response has no matching <turbo-frame id=...> element ...
I'm receiving the following error message: Response has no matching <turbo-frame id="experiments"> element . However, the response is not ...
Read more >
How to deal with 500 in the frame? - Hotwire Discussion
I have a <turbo-frame> and when I submit form it gets replaced. ... writes ts to console: Response has no matching <turbo-frame id="some-frame">...
Read more >
Turbo Frames on Rails - Colby.so
What's a matching Turbo Frame tag? Let's look at that next. Responding with frame content. The power of Turbo Frames is in replacing...
Read more >
Turbo Frames and Turbo Stream templates - Hotrails
The frame disappears from the page, and there is an error in the console: Response has no matching <turbo-frame id="first_turbo_frame"> ...
Read more >
Hotwired ASP.NET Core Web Application — Part 3 - Medium
If you want to follow along with the tutorial, you can download the current ... The error when the response has no matching...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found