Problem/Motivation

An user reported on this slack thread https://drupal.slack.com/archives/C5ABFBZ5Z/p1673950377454769 a JS error. Because of it, there are some other parts of the page that aren't loaded, as they rely on JS code, like the tests results for a MR, as well as others.

Steps to reproduce

Not sure for how long this will keep on happening, as uncached pages seem to be ok.
It depends on whether the gitlab endpoint times out or not. For now we saw it in #2959723: Create an initial class for the batch processor service shows the error.

The error is this:
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'notes')

Debugging the graphql call we can see that the issue is due to timeouts. This is the result:

{
  "data": {
    "project": {
      "mergeRequests": {
        "nodes": [
          null
        ]
      }
    }
  },
  "errors": [
    {
      "message": "Timeout on Discussion.id",
...      ]
    },
    {
      "message": "Timeout on Note.author",
...
    },
    {
      "message": "Timeout on Note.id",
...
    },
    {
      "message": "Timeout on Note.id",
...

Proposed resolution

If there is no data returned, don't go through the code and perhaps show a message to the user.

Remaining tasks

Provide MR.

User interface changes

If the same happens, MR notes won't be shown but the rest of the JS in the page should continue to work.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#4 Issue-3334134-console-error.png237.54 KBbhanu951

Issue fork drupalorg-3334134

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

fjgarlin created an issue. See original summary.

fjgarlin’s picture

Assigned: fjgarlin » Unassigned
Status: Active » Needs review

Ready for review, at least there won't be a JS error in this scenario.

bhanu951’s picture

StatusFileSize
new237.54 KB

@fjgarlin : Can confirm that I am facing this issue .

>as uncached pages seem to be ok.

I don't think this is the case as there are still errors in the console even after adding random query param string to the url.

Was having same issue #2959723 from a long time. Commits used to appear after couple of minutes after page load. But from the past 5-6 hours they are not being visible anymore.

Please refer below image.

2023-01-17/Issue-3334134-console-error.png

bhanu951’s picture

@fjgarlin:

As an end user is there any way I can test this fix ?

fjgarlin’s picture

Agree, it's not cache related. It's the gitlab endpoint timing out.

This MR will just fix the javascript code not breaking, the timeout is another issue altogether which the infra team is looking at.

I don't think that there is a way that you can test it I'm afraid (other than checking the code in the MR). Thanks for the confirmation of the issue and the additional information.

fjgarlin’s picture

Issue summary: View changes
fjgarlin’s picture

Issue summary: View changes

drumm made their first commit to this issue’s fork.

  • drumm committed b9cd2e52 on 7.x-3.x authored by fjgarlin
    Issue #3334134: JS error when graphql query doesn't include the expected...
drumm’s picture

Status: Needs review » Fixed

This has been deployed

bhanu951’s picture

FTR , Additional Timeout errors I got in console.

Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'interest-cohort'.

27[Violation] Added non-passive event listener to a scroll-blocking <some> event. Consider marking event handler as 'passive' to make the page more responsive. See <URL>
2959723:15 
[Violation] 'DOMContentLoaded' handler took 185ms
[Violation] Forced reflow while executing JavaScript took 58ms
wrap-function.js:56 

POST https://bam.nr-data.net/jserrors/1/e671e25255?a=4266189&v=1221.PROD&to=Z1AEbREHVxAFU0RRV14aJ1oXD1YNS15fXF1vRQdeBjlPCgFH&rst=20722&ck=0&s=cdedd9925d4e6516&ref=https://www.drupal.org/project/drupal/issues/2959723 403 (Forbidden)

POST https://bam.nr-data.net/jserrors/1/e671e25255?a=4266189&v=1221.PROD&to=Z1AEbREHVxAFU0RRV14aJ1oXD1YNS15fXF1vRQdeBjlPCgFH&rst=20723&ck=0&s=cdedd9925d4e6516&ref=https://www.drupal.org/project/drupal/issues/2959723 403 (Forbidden)

2959723:15 [Violation] 'setTimeout' handler took 83ms
[Violation] Forced reflow while executing JavaScript took 31ms
2959723:15 [Violation] 'requestAnimationFrame' handler took 50ms
[Violation] Forced reflow while executing JavaScript took 48ms

POST https://bam.nr-data.net/jserrors/1/e671e25255?a=4266189&v=1221.PROD&to=Z1AEbREHVxAFU0RRV14aJ1oXD1YNS15fXF1vRQdeBjlPCgFH&rst=30728&ck=0&s=cdedd9925d4e6516&ref=https://www.drupal.org/project/drupal/issues/2959723 403 (Forbidden)

fjgarlin’s picture

Those are related to a different issue and being addressed separately. Thanks for reporting them.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.