Skip to content

Do custom blocks not get added to the block-renderer/ api endpoint by default? #12057

Closed

Description

@mrpritchett

I'm trying to use ServerSideRender and hitting an issue where non of our custom blocks are being registered on the API endpoint for block-renderer/.

Activity

  1. added
    [Type] Help Request
    on Nov 19, 2018
  2. added
    Needs Technical Feedback
    on Nov 27, 2018
  3. pojke commented on Jan 15, 2019

    @pojke

    Subscribing to this. All of our blocks since WP 5.0.3 (that were using ServerSideRender) stopped working as the API is not registered.

    On a side note, it gets a bit boring when you hear in August 2018 that there are no major changes to Gutenberg, join the boat, try to help the community just to hit the wall hard when the editor breaks backwards compatibility literally monthly 👎 #feelingLikeJoomla

  4. opensaurusrex commented on Jan 18, 2019

    @opensaurusrex

    I keep getting: GET /wp-json/wp/v2/block-renderer/library-plugin/frontpage-releases?context=edit&_locale=user 404 (Not Found) in the console and the request content I get is: {"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}}

  5. designsimply commented on Feb 12, 2019

    @designsimply
    Member

    @mrpritchett, I tried researching this and the most recent pull request I could find about block registration with regard to the API is in #13693 which appears to be the first step towards making all core, and optionally plugin, blocks discoverable on the server. I am new to JavaScript and block development. I think 13693 might be the most relevant because when I read the RFC I noticed two bullet points in the proposal which look like they might be relevant to your question:

    • Building REST APIs to fetch the available block types
    • Building REST APIs to fetch block objects from posts

    The "References" and "Previous attempts" sections in the RFC talk about previous explorations and those also look interesting.

    May I ask whether the information in #13693 answers your question?

  6. mrpritchett commented on Feb 17, 2019

    @mrpritchett
    Author

    Sorry, lost track of my own issue. For our team, the issue was where our custom webpack setup was enqueueing the files and partially where they were being compiled (at runtime). We played with settings and config and eventually got it to work just fine.

  7. grappler commented on Mar 19, 2019

    @grappler
    Member

    Adding a note here because I came here via Google trying to figure out why I was getting a rest_no_route.

    The reason for me was that register_block_type() was only running when is_admin() was true.

  8. opensaurusrex commented on Mar 19, 2019

    @opensaurusrex

    The issue I was having seemed to be fixed with WP 5.1, so now the dynamic blocks are working again.

  9. shahalom commented on Nov 24, 2019

    @shahalom

    The issue is still producing with wp-v5.3.x. I have mentioned detail code here ... https://stackoverflow.com/questions/59018433/serversiderender-components-producing-error-loading-block-no-route-was-found-m

    Please add a detail note here so that many of us can read when google send us ... Thanks.

  10. mrpritchett commented on Nov 24, 2019

    @mrpritchett
    Author

    This ended up being a problem with where our custom blocks were hooked into, not an actual WP issue itself.

  11. shahalom commented on Nov 24, 2019

    @shahalom

    This ended up being a problem with where our custom blocks were hooked into, not an actual WP issue itself.

    Thank you for the reply, I hope it is not an issue of WP itself now. My block hook is in the right place and still seeing the error!

  12. leurdo commented on Sep 14, 2020

    @leurdo

    Adding a note here because I came here via Google trying to figure out why I was getting a rest_no_route.

    The reason for me was that register_block_type() was only running when is_admin() was true.

    saved my day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Technical Feedback[Package] Server Side Render[Type] Help Request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions