• Resolved semiherdogan

    (@semiherdogan)


    Hi,

    When I use the IDE to check the query, I receive undefined constant error. Does anyone face with such a case. I updated the php version in april to 8.1. Does anyone use this plugin with this php version, might it be related to the php version?

    {
    "errors": [
    {
    "debugMessage": "Undefined constant \"path\"",
    "message": "Internal server error",
    "extensions": {
    "category": "internal"
    },
    "locations": [
    {
    "line": 13,
    "column": 11
    }
    ],
    "path": [
    "blogs",
    "nodes",
    0,
    "featuredImage",
    "node",
    "sourceUrl"
    ]
    },
    {
    "debugMessage": "Undefined constant \"path\"",
    "message": "Internal server error",
    "extensions": {
    "category": "internal"
    },
    "locations": [
    {
    "line": 13,
    "column": 11
    }
    ],
    "path": [
    "blogs",
    "nodes",
    1,
    "featuredImage",
    "node",
    "sourceUrl"
    ]
    },
    {
    "debugMessage": "Undefined constant \"path\"",
    "message": "Internal server error",
    "extensions": {
    "category": "internal"
    },
    "locations": [
    {
    "line": 13,
    "column": 11
    }
    ],
    "path": [
    "blogs",
    "nodes",
    2,
    "featuredImage",
    "node",
    "sourceUrl"
    ]
    }
    ],
    "data": {...
Viewing 1 replies (of 1 total)
  • Plugin Author Jason Bahl

    (@jasonbahl)

    @semiherdogan I regularly use WPGraphQL with several versions of PHP and our tests also run on several versions of PHP including PHP 8.1

    I would recommend following the debugging guide to help you get more information: https://www.wpgraphql.com/docs/debugging

    What is the query you are trying to execute? Based on the error message it looks like you are trying to query something like the following:

    {
    blogs {
    nodes {
    featuredImage {
    node {
    sourceUrl
    }
    }
    }
    }
    }

    Out of the box, this is not a valid query because there is no field “blogs” in the Schema. If you’re expecting to be able to query this, then something (a plugin or custom code) has extended the Schema and that code _might_ be causing issues.

    If you’re not able to pinpoint the issue following the Debug guide linked above, I would recommend de-activating any plugins or custom code and then activating things one at a time until you are able to identify the source of the bug.

Viewing 1 replies (of 1 total)
  • The topic ‘query error undefined constant’ is closed to new replies.