Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Server Error: GraphQL fails to get oembed fields #46

Closed
denisyilmaz opened this issue Jun 3, 2020 · 20 comments · Fixed by #49
Closed

Internal Server Error: GraphQL fails to get oembed fields #46

denisyilmaz opened this issue Jun 3, 2020 · 20 comments · Fixed by #49
Assignees

Comments

@denisyilmaz
Copy link

Since version 1.3.0 the oEmbed field fails in GraphQL with an internal server error. For example:

oembed {
    ... on oembed_OembedField {
        code
    }
}

results in:

Undefined property: class@anonymous::$code

Versions:
CraftCMS – 3.4.22.1
oEmbed – 1.3.1

@reganlawton
Copy link
Member

Argh ok that’s abit weird. Can I know the lin Lyon used to get the error?

@denisyilmaz
Copy link
Author

Hm, I now downgraded to 1.2.5 but have the same error. It seems it has to do with my staging server as my local server has access to the field without any problem. the error log doesn't show any additional information.

but I found an additional error:

{
  "debugMessage": "Expected a value of type \"String\" but received: {\"url\":\"https:\\/\\/www.youtube.com\\/embed\\/K5RQAK3SDEI\",\"oembed\":null}",
  "message": "Internal server error",
  "category": "internal",
  "locations": [
    {
      "line": 101,
      "column": 3
    }
  ],
  "path": [
    "entry",
    "contentBlocks",
    0,
    "oembed",
    "url"
  ]
}

@reganlawton
Copy link
Member

Perfect 🙌 ill look at this tomorrow. Do you also have the link your trying to use?

@denisyilmaz
Copy link
Author

@reganlawton thx for the quick reply. I've send you an email with the link: https://www.basics.ynm.studio/de/hair-make-up/artists/kerstin-hoffmann/projekt/sir-ben-kingsley-a-ordinary-men?category=10975

the absolute strange thing: another project that has a different youtube embed works like charm. and when I copy the embed (https://www.youtube.com/watch?v=K5RQAK3SDEI) to my local backend it works as well. only some combination of entry + embed fails to load.

@reganlawton
Copy link
Member

@denisyilmaz ARGH! I see the error here.

THis works for me

{
  entries {
    id,
    ... on page_page_Entry {
      media {
        code,
        providerUrl,
        aspectRatio
      }
    }
  }
}

BUT this doesnt..

{
  entries {
    id,
    ... on page_page_Entry {
      media
    }
  }
}

Seems the issue here is I missing the return scope for the edge case for no sub set.

As said the quick solve is as above, but I'll look into a solve for this.

@reganlawton
Copy link
Member

@denisyilmaz Give v1.3.2 a shot

@denisyilmaz
Copy link
Author

Hi @reganlawton
I just updated to 1.3.2 but now GraphQL crashes instantly:

From CraftCMS CP:

  "name": "PHP Fatal Error",
  "message": "Interface 'craft\\gql\\base\\SingleGeneratorInterface' not found",
  "code": 1,
  "type": "yii\\base\\ErrorException",
  "file": "/var/www/html/vendor/wrav/oembed/src/gql/OembedFieldTypeGenerator.php",
  "line": 19,
  "stack-trace": [
    "#0 [internal function]: yii\\base\\ErrorHandler->handleFatalError()",
    "#1 {main}"
  ]
}

@denisyilmaz
Copy link
Author

denisyilmaz commented Jun 15, 2020

ah, I guess you tested this in CraftCMS 3.5, right? I'm still on 3.4.23.

So 1.3.2 is not compatible with 3.4.23 resulting in internal Server error when using your plugin via GraphQL

@denisyilmaz
Copy link
Author

image

@reganlawton
Copy link
Member

Argh I might have 🤔 I’ll have to patch this today.

@joshuabaker
Copy link
Contributor

joshuabaker commented Jun 22, 2020

@reganlawton 1.3.2 references what sounds like the same issue, but we’re still seeing this. What’s needed to get this working?

Answering myself: Downgrading wrav/oembed to 1.3.1 works again with Craft 3.4.x.

@reganlawton
Copy link
Member

Ok so the issue here is that the queries in 1.3.1 don't work if you don't provide the sub selection. In 1.3.2 the issue isn't there due to CraftCMS having a new class. I didnt realise I was developing on CC 3.5 Beta still which has the fix so Im currently trying to build a 3.4 and 3.5 working version.

1.3.1 Still works BUT you need to add the sub selection fields see my previous reply. I'm currently just in a the middle of two major SaaS releases this week so its been a bit tricky to find till in my +12hr days. But I am working on this promise 😅

@denisyilmaz ARGH! I see the error here.

THis works for me

{
  entries {
    id,
    ... on page_page_Entry {
      media {
        code,
        providerUrl,
        aspectRatio
      }
    }
  }
}

BUT this doesnt..

{
  entries {
    id,
    ... on page_page_Entry {
      media
    }
  }
}

Seems the issue here is I missing the return scope for the edge case for no sub set.

As said the quick solve is as above, but I'll look into a solve for this.

@joshuabaker
Copy link
Contributor

I’m seeing a few issues here after bumping this install to Craft 3.5.

GQL

embedUrl {
  code
  width
  height
}

# ~ or ~

embedUrl {
  ...on embedUrl_OembedField {
    code
    width
    height
  }
}

1.3.1 - Errors

Undefined property: class@anonymous::$code

1.3.2 - Null values

"embedUrl": {
  "code": null,
  "width": null,
  "height": null
}

P.s. 12+ hour days here too. 😭 Sending luck. 🍀

@reganlawton
Copy link
Member

Anon class means that it’s the fallback object 🤔 I’ll try look into this today. Yes it’s pretty crazy but hoping everything smooths out next week after my major launches.

@joshuabaker
Copy link
Contributor

@reganlawton Have you had a chance to look at this? 🙂

We’ve got a delivery this week and I’m wondering if we need to swap out the oEmbed fields.

@reganlawton
Copy link
Member

@joshuabaker Im on it in a moment

@reganlawton
Copy link
Member

reganlawton commented Jun 29, 2020

@joshuabaker also what's your running versions? Are you on the CraftCMS discord?

Versions of the CraftCMS your going live with? 3.4 or 3.5?

@joshuabaker
Copy link
Contributor

Versions of the CraftCMS your going live with? 3.4 or 3.5?

craftcms/cms: 3.5.0-beta.3
wrav/oembed: 1.3.2

Are you on the CraftCMS discord?

Yep. Same username as here.

@reganlawton
Copy link
Member

@joshuabaker @denisyilmaz

I have a new release v1.3.4 it seems it was an issue with PHP ?? operator and the PHP magic method __get().

If anyone continues to have issues please feel free to post here I'm much more free'd up with my two latest projects launching today. Otherwise feel we to ping me on Discord reganlawton#1354 and I'll be able to troubleshoot with you, @joshuabaker we already connected 👍, and get a fix done quickly.

This issue has raised issues with my current release format and being that CraftCMS uses my plugin in its starter blog project, I'll be looking at future workflow to move to an alpha, beta, release format to allow for more stable releases moving into the future.

Thanks again to everyone for their help with error logs and most importantly the patiences on this one.

@reganlawton reganlawton self-assigned this Jun 29, 2020
@reganlawton reganlawton linked a pull request Jun 29, 2020 that will close this issue
@joshuabaker
Copy link
Contributor

Thank you, @reganlawton!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants