With Drupal 10.2.0 the rest api doesn't return a valid json

Created on 29 December 2023, 12 months ago
Updated 13 May 2024, 7 months ago

All works well with drupal 10 before drupal 10.2.0

But, after upgrade to Drupal 10.2.0, in the full calendar view there is no more unit to book.

The cause of this i because this call doesn't return a valid json:
/bat_api/calendar-units?_format=json&types=7&ids=&event_type=availability_hourly&_=1703844559776

I get this json:

  [{"id":"7","title":"P3 Lab","children":[{"id":"S92","title":"Chromatograph \u00c4KTA Go_IRSIQ 12\/006","create_event":true},{"id":"S93","title":"Cytometer Canto_IRSIQ 31\/006","create_event":true},{"id":"S94","title":"Cytometer FacsCelesta_IRSIQ 31\/004","create_event":true},{"id":"S95","title":"Cytometer LRSII_IRSIQ 31\/002","create_event":true},{"id":"S96","title":"Elispot washer_IRSIQ 29\/002 (inside hood 15)","create_event":true},{"id":"S97","title":"Ensight Reader (Elisa reader)_IRSIQ 24\/006","create_event":true},{"id":"S98","title":"Extractor KingFisher Flex_IRSIQ 30\/003","create_event":true},{"id":"S99","title":"Fluorescence microscope_IRSIQ 16\/002","create_event":true},{"id":"S100","title":"Hood 01_ IRSIQ 05\/002 (transfection)","create_event":true},{"id":"S101","title":"Hood 02_IRSIQ 05\/020 (Groups MOL I and IgG)","create_event":true},{"id":"S102","title":"Hood 03_IRSIQ 05\/006 (Group VIRIEVAC)","create_event":true},{"id":"S103","title":"Hood 06_IRSIQ 05\/007 (Group GREC)","create_event":true},{"id":"S104","title":"Hood 07_IRSIQ 05\/007 (Group GREC)","create_event":true},{"id":"S105","title":"Hood 08_IRSIQ 05\/021 (Groups GEM and PISTA)","create_event":true},{"id":"S106","title":"Hood 09_IRSIQ 05\/021 (Groups VITI)","create_event":true},{"id":"S107","title":"Hood 10_IRSIQ 05\/001 (Group VIHIT)","create_event":true},{"id":"S108","title":"Hood 11_IRSIQ 05\/012 (Group CB)","create_event":true},{"id":"S109","title":"Hood 12_IRSIQ 05\/012 (Group CB)","create_event":true},{"id":"S110","title":"Hood 13_IRSIQ 05\/017 (Group Serveis)","create_event":true},{"id":"S111","title":"Hood 14_IRSIQ 05\/017 (Groups NeoVaCan and TRIA)","create_event":true},{"id":"S112","title":"Hood 05_IRSIQ 05\/005 (Group VIC)","create_event":true},{"id":"S113","title":"Hood 04_IRSIQ 05\/005 (Group VIC)","create_event":true},{"id":"S114","title":"Cytometer calibur_IRSIQ 31\/001\t","create_event":true},{"id":"S115","title":"Elispot reader system_IRSIQ 24\/008","create_event":true},{"id":"S116","title":"Elispot washer 2_IRSIQ 29\/008","create_event":true},{"id":"S117","title":"Ultracentrifuge_IRSIQ 03\/027","create_event":true},{"id":"S118","title":"ddPCR Generator_IRSIQ 09\/019\t","create_event":true}]

Instead of this:

  [{"id":"7","title":"P3 Lab","children":[{"id":"S92","title":"Chromatograph \u00c4KTA Go_IRSIQ 12\/006","create_event":true},{"id":"S93","title":"Cytometer Canto_IRSIQ 31\/006","create_event":true},{"id":"S94","title":"Cytometer FacsCelesta_IRSIQ 31\/004","create_event":true},{"id":"S95","title":"Cytometer LRSII_IRSIQ 31\/002","create_event":true},{"id":"S96","title":"Elispot washer_IRSIQ 29\/002 (inside hood 15)","create_event":true},{"id":"S97","title":"Ensight Reader (Elisa reader)_IRSIQ 24\/006","create_event":true},{"id":"S98","title":"Extractor KingFisher Flex_IRSIQ 30\/003","create_event":true},{"id":"S99","title":"Fluorescence microscope_IRSIQ 16\/002","create_event":true},{"id":"S100","title":"Hood 01_ IRSIQ 05\/002 (transfection)","create_event":true},{"id":"S101","title":"Hood 02_IRSIQ 05\/020 (Groups MOL I and IgG)","create_event":true},{"id":"S102","title":"Hood 03_IRSIQ 05\/006 (Group VIRIEVAC)","create_event":true},{"id":"S103","title":"Hood 06_IRSIQ 05\/007 (Group GREC)","create_event":true},{"id":"S104","title":"Hood 07_IRSIQ 05\/007 (Group GREC)","create_event":true},{"id":"S105","title":"Hood 08_IRSIQ 05\/021 (Groups GEM and PISTA)","create_event":true},{"id":"S106","title":"Hood 09_IRSIQ 05\/021 (Groups VITI)","create_event":true},{"id":"S107","title":"Hood 10_IRSIQ 05\/001 (Group VIHIT)","create_event":true},{"id":"S108","title":"Hood 11_IRSIQ 05\/012 (Group CB)","create_event":true},{"id":"S109","title":"Hood 12_IRSIQ 05\/012 (Group CB)","create_event":true},{"id":"S110","title":"Hood 13_IRSIQ 05\/017 (Group Serveis)","create_event":true},{"id":"S111","title":"Hood 14_IRSIQ 05\/017 (Groups NeoVaCan and TRIA)","create_event":true},{"id":"S112","title":"Hood 05_IRSIQ 05\/005 (Group VIC)","create_event":true},{"id":"S113","title":"Hood 04_IRSIQ 05\/005 (Group VIC)","create_event":true},{"id":"S114","title":"Cytometer calibur_IRSIQ 31\/001\t","create_event":true},{"id":"S115","title":"Elispot reader system_IRSIQ 24\/008","create_event":true},{"id":"S116","title":"Elispot washer 2_IRSIQ 29\/008","create_event":true},{"id":"S117","title":"Ultracentrifuge_IRSIQ 03\/027","create_event":true},{"id":"S118","title":"ddPCR Generator_IRSIQ 09\/019\t","create_event":true}]}]

The only difference is that the i needs a }] and the end.

It seems a Drupal core bug or something that needs to adapt in bat_api, but i don't know what.

๐Ÿ› Bug report
Status

Closed: works as designed

Version

3.1

Component

Code

Created by

๐Ÿ‡ช๐Ÿ‡ธSpain Carlitus

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Carlitus
  • ๐Ÿ‡ช๐Ÿ‡ธSpain Carlitus
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States TolstoyDotCom L.A.

    I looked into this a bit. I'm not familiar with this module, but that URL returns invalid JSON without having to do any setup.

    After enabling the module, when I access http://127.0.0.1/drupal1020/web/bat_api/calendar-units?_format=json&types=7&ids=&event_type=availability_hourly&_=1703844559776

    I get this:

    {"message":"No route found for \u0022GET http:\/\/127.0.0.1\/drupal1020\/web\/bat_api\/calendar-units\u0022

    However, in Symfony\Component\HttpKernel\HttpKernel::handle, when I change the code so it has $response = $this->handleThrowable($e, $request, $type); and then print out '' . $response, I get correct JSON. That is, converting $response to a string at that point is not missing the final "}.

    As a wild guess, there was a workaround added that cuts off the last two characters of the return value, but whatever the workaround was for no longer applies.

  • Status changed to Needs work 12 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome
  • Status changed to Postponed: needs info 12 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome

    About #3, can you please confing the url
    " http://127.0.0.1/drupal1020/web/bat_api/calendar-units?_format=json&type..."

    It should be something like: WEBSERVERNAME + "/bat_api/calendar....."

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome

    On fresh new install, Drupal Version 10.2.0, /bat_api/calendar-units?_format=json&types=1&ids=&event_type=availability_hourly&_=1703844559776

    produces a correct json output:

    [{"id":"1","title":"Apts Property #1","children":[{"id":"S1","title":"tttt","create_event":true}]}]

    with a single sample unit created.

    After deleting that sample unit, bat api produces

    /bat_api/calendar-units?_format=json&types=1&ids=&event_type=availability_hourly&_=1703844559776

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome

    Tested on the upcoming version (post 3.1.0-beta1)

  • ๐Ÿ‡ช๐Ÿ‡ธSpain Carlitus

    With the last versiรณn (3.1.0-rc1) i get a different but incomplete result:

    [
        {
            "id": "0103",
            "bat_id": 0,
            "resourceId": "S103",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0104",
            "bat_id": 0,
            "resourceId": "S104",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "092",
            "bat_id": 0,
            "resourceId": "S92",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "093",
            "bat_id": 0,
            "resourceId": "S93",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "094",
            "bat_id": 0,
            "resourceId": "S94",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "095",
            "bat_id": 0,
            "resourceId": "S95",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "096",
            "bat_id": 0,
            "resourceId": "S96",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "097",
            "bat_id": 0,
            "resourceId": "S97",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "098",
            "bat_id": 0,
            "resourceId": "S98",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "099",
            "bat_id": 0,
            "resourceId": "S99",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0100",
            "bat_id": 0,
            "resourceId": "S100",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0101",
            "bat_id": 0,
            "resourceId": "S101",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0102",
            "bat_id": 0,
            "resourceId": "S102",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0105",
            "bat_id": 0,
            "resourceId": "S105",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0106",
            "bat_id": 0,
            "resourceId": "S106",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0107",
            "bat_id": 0,
            "resourceId": "S107",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0108",
            "bat_id": 0,
            "resourceId": "S108",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0109",
            "bat_id": 0,
            "resourceId": "S109",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0110",
            "bat_id": 0,
            "resourceId": "S110",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0111",
            "bat_id": 0,
            "resourceId": "S111",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0112",
            "bat_id": 0,
            "resourceId": "S112",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0113",
            "bat_id": 0,
            "resourceId": "S113",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0114",
            "bat_id": 0,
            "resourceId": "S114",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0115",
            "bat_id": 0,
            "resourceId": "S115",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0116",
            "bat_id": 0,
            "resourceId": "S116",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0117",
            "bat_id": 0,
            "resourceId": "S117",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
        },
        {
            "id": "0118",
            "bat_id": 0,
            "resourceId": "S118",
            "start": "2024-01-04T00:00:00",
            "end": "2024-01-05T00:00:00",
            "title": "Disponible",
            "color": "#009AD8",
            "blocking": 0,
            "fixed": 1,
            "editable": false,
            "rendering": "background",
            "type": "availability_hourly"
    
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome

    Hi!
    Can you please confirm the last line of the json output is "type": "availability_hourly"?

  • ๐Ÿ‡ช๐Ÿ‡ธSpain Carlitus

    Yes, confirmed.

  • Status changed to Needs work 12 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States TolstoyDotCom L.A.

    Re #5, this URL:

    http://127.0.0.1/drupal1020/web/bat_api/calendar-units?_format=json&types=7&ids=&event_type=availability_hourly&_=1703844559776

    Results in this JSON:

    {"message":"No route found for \u0022GET http:\/\/127.0.0.1\/drupal1020\/web\/bat_api\/calendar-units\u0022

    It's missing the final "}

    Like I said, I'm not familiar with the module. I just installed/enabled it in a new site, I didn't create any content for it.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome

    trying to fix #12:

    what is you open
    "http://127.0.0.1/bat_api/calendar-units?_format=json&types=7&ids=&event_type=availability_hourly&_=1703844559776"
    (remove drupal1020/web/)
    ?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States TolstoyDotCom L.A.

    Re #13, that wouldn't work. The "drupal1020" part is because I have multiple local sites, and the "web" part is because I installed Drupal using the standard composer project. If I installed this at the root of its own domain there'd still be the problem (unless the module is doing something really weird).

    What I suggest is tracing through a request in a debugger, or removing things until you can pinpoint where the problem is coming from.

    Also, I checked Symfony\Component\Serializer\Encoder\JsonEncoder::encode(), which is used to produce the JSON. It's returning correct JSON. Something must be changing it somewhere along the line.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome

    Well, being the message pretty clear "message":"No route found ", I'd suggest to start from that....

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States TolstoyDotCom L.A.

    The problem everyone seems to be having is that the end of the JSON is being cut off. Even if the route exists, the JSON is invalid. There's some sort of bug or incompatibility between Drupal 10.2.0 and this module or one of this module's dependencies.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome

    I see now the json error on #12

    {"message":"No route found for \u0022GET http:\/\/127.0.0.1\/drupal1020\/web\/bat_api\/calendar-units\u0022

    It's missing the final "}

    Thanks for clarifing that

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada g011um Saskatoon

    We've been having issues creating nodes via REST/JSONAPI since upgrading to 10.2.0 (10.1.7 worked flawlessly) and in searching for help with that, I came across this issue. Our problem is very similar; we POST data to create a node, and the JSON response returned is missing a few characters at the end, including the final ]} which renders the response invalid.

    So I'm wondering your this issue might be related, and if the root cause might not be with bat_api itself, but perhaps something more central to Drupal -- some service/module responsible for HTTP responses, streams or conversion of data to JSON; something that might truncate the response?

    It's perhaps a shot in the dark, but I thought I'd mention it, just in case it helped in debugging this issue. Maybe it's not your code that's at fault, maybe it's something in Drupal itself.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States TolstoyDotCom L.A.

    g011um: the bat_api module depends on bat, ctools, fullcalendar_library, hal, and services. Are you using any of those modules? If so, is it possible for you to disable the ones you're using to see if it's one of those modules as opposed to core/vendor?

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada g011um Saskatoon

    We're not using bat, fullcalendar or services. We have ctools installed but not enabled. HAL is installed and enabled.

    We're primarily making use of JSON:API in core to create nodes from an external script. We do a POST to the "/node" URL, the node is created, but since upgrading from 10.1.7 to 10.2.0 the JSON response we get back is truncated. This seems to happen more frequently if we're creating a node with a formatted text field.

    Our issues may not be related, but the fact that we are both seeing truncated JSON responses from Drupal after upgrading to 10.2.0 was enough that I thought I'd mention it.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome

    testing out:

    * Drupal Version 10.2.1
    * drush en bat_api
    * open http://d10.beehotel/a-wrong-path/bat_api/calendar-units?_=1703844559776&_format=json&event_type=availability_hourly&ids=&types=7
    * output: {"message":"No route found for \u0022GET http:\/\/d10.beehotel\/a-wrong-path\/bat_api\/calendar-units\u0022"} (JSON is valid)

  • ๐Ÿ‡ช๐Ÿ‡ธSpain Carlitus

    With Drupal 10.2.1 it's the same. And i see that with calendar-units endpoint (/bat_api/calendar-units?_format=json&types=8&ids=&event_type=availability_hourly&_=1704794828919) there is the same problem:

    [
        {
            "id": "8",
            "title": "P2 Lab",
            "children": [
                {
                    "id": "S119",
                    "title": "RNA Extraction Area",
                    "create_event": true
                },
                {
                    "id": "S120",
                    "title": "Hood 16_IRSIQ 05\/029 - Sample Processing",
                    "create_event": true
                },
                {
                    "id": "S121",
                    "title": "Hood 17_IRSIQ 05\/029 - Sample Processing",
                    "create_event": true
                },
                {
                    "id": "S122",
                    "title": "Hood 18_IRSIQ 05\/027",
                    "create_event": true
                },
                {
                    "id": "S123",
                    "title": "Hood 19_IRSIQ 05\/028",
                    "create_event": true
                },
                {
                    "id": "S124",
                    "title": "DNA extraction area 1",
                    "create_event": true
                },
                {
                    "id": "S125",
                    "title": "DNA extraction area 2",
                    "create_event": true
                },
                {
                    "id": "S126",
                    "title": "Hood DNA adition_IRSIQ 05\/024",
                    "create_event": true
                },
                {
                    "id": "S127",
                    "title": "Hood RNA adition_IRSIQ 05\/025",
                    "create_event": true
                }
            ]
    
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States SocialNicheGuru
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States SocialNicheGuru
  • ๐Ÿ‡ช๐Ÿ‡ธSpain Carlitus

    I get the same result with the last bat_api 3.1RC, the json it's not valid

  • I'm experiencing quite the same issue as g011um and some others, since upgrading from 10.1 to 10.2 the JSON response we get from our custom resource REST API is truncated (the last closing curly bracket is missing).
    I tried returning ResourceResponse with and without cache dependencies, ModifiedResourceResponse and even a basic JSONRepsonse and it always comes out missing the last character.
    Maybe it has something the REST API settings or maybe even with the cache settings, but it was working perfectly before the Drupal core upgrade. I'm really clueless now.
    Do you guys have resolved your issues yet ?

  • ๐Ÿ‡ช๐Ÿ‡ธSpain Carlitus

    I have not any file with a php closing tag.

    I've a made a core MR, more of a temporal solution, but now it works:
    https://www.drupal.org/project/drupal/issues/3432990 ๐Ÿ› Content-length incorrect and response truncated in web servers Active

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome

    How can I reproduce?
    Please contribute to the related debug issue https://www.drupal.org/project/bat_api/issues/3433154 ๐Ÿ“Œ Debug #3411329 Active

    The very basic structure (not too much stuff.. maybe just what is needed to recreate the issue) of the entity breaking the JSON would help
    Thanks

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome
  • Status changed to Closed: works as designed 8 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome
  • ๐Ÿ‡ช๐Ÿ‡ธSpain Carlitus

    Finnaly i found it!

    It's in the bat module, in bat_event.module.

    The first line has a whitespace before the opening php tag.
    https://git.drupalcode.org/project/bat/-/blob/8.x-2.x/modules/bat_event/...

    it has

     <?php
    

    Instead of

    <?php
    
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome

    ah! Thanks a lot Carlitus

    It's my bad really
    I must extend the phpcs check to *modules

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome

    you have it fixed already in 8.x-10.x

    https://git.drupalcode.org/project/bat/-/blob/8.x-10.x/modules/bat_event...

    That's why was that difficult to re-create. Better use latest release where possible

  • ๐Ÿ‡ช๐Ÿ‡ธSpain Carlitus

    You are right, i don't know why i was using 2.0, sorry.

Production build 0.71.5 2024