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

Error: Resource of type 'node--article' not found #244

Closed
xpersonas opened this issue Jun 28, 2022 · 7 comments
Closed

Error: Resource of type 'node--article' not found #244

xpersonas opened this issue Jun 28, 2022 · 7 comments
Assignees

Comments

@xpersonas
Copy link

I feel like an idiot here. I'm failing at a relatively early stage in this process. Trying to provide as much info as possible, but there's not a lot to go on...

error - Error: Resource of type 'node--article' not found.
    at /Users/jneel/Sites/personal/movie-app-options/drupal-site/movie-flix/node_modules/next-drupal/dist/index.js:2023:17
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async getStaticProps (webpack-internal:///./pages/index.tsx:97:19)
    at async Object.renderToHTML (/Users/jneel/Sites/personal/movie-app-options/drupal-site/movie-flix/node_modules/next/dist/server/render.js:451:20)
    at async doRender (/Users/jneel/Sites/personal/movie-app-options/drupal-site/movie-flix/node_modules/next/dist/server/base-server.js:917:38)
    at async cacheEntry.responseCache.get.isManualRevalidate.isManualRevalidate (/Users/jneel/Sites/personal/movie-app-options/drupal-site/movie-flix/node_modules/next/dist/server/base-server.js:1022:28)
    at async /Users/jneel/Sites/personal/movie-app-options/drupal-site/movie-flix/node_modules/next/dist/server/response-cache.js:69:36 {
  page: '/'
}
Drupal version: 9.4.1          
Content type: Article (article) // Definitely exists. Definitely has many nodes.
Module is definitely installed and enabled (drupal/next - "drupal/next": "^1.2")
Patches are in composer.json and applied successfully.
Node: v18.4.0 (also tried v14.15.5)
NVM: 0.39.1

I've tried connecting to a new site install following along with the docs composer create-project drupal/recommended-project drupal-site and I have tried on some of my existing Drupal sites. Always the same result.

No errors on the Drupal side that I can find. Nothing in log.

@shadcn
Copy link
Collaborator

shadcn commented Jun 28, 2022

hmm, when you visit the /jsonapi path on your Drupal site, do you see the node--article resource?

@xpersonas
Copy link
Author

Ah ok. Didn't know to check there. Now I'm seeing an error. But not sure what to make of it. The site(s) I'm trying to access are fully functional local sites with clean urls. Let me know if any other details would help.

(I'm using Larave's Valet currently, but drush runserver 127.0.0.1:8888 gave the same result.)

{
  "jsonapi": {
    "version": "1.0",
    "meta": {
      "links": {
        "self": {
          "href": "http://jsonapi.org/format/1.0/"
        }
      }
    }
  },
  "errors": [
    {
      "title": "Bad Request",
      "status": "400",
      "detail": "The following query parameters violate the JSON:API spec: 'q'.",
      "links": {
        "via": {
          "href": "https://exampleusa.test/jsonapi"
        },
        "info": {
          "href": "http://jsonapi.org/format/#query-parameters"
        }
      },
      "source": {
        "file": "/Users/jneel/Sites/work/example-website/web/core/modules/jsonapi/src/EventSubscriber/JsonApiRequestValidator.php",
        "line": 78
      },
      "meta": {
        "exception": "Drupal\\Core\\Http\\Exception\\CacheableBadRequestHttpException: The following query parameters violate the JSON:API spec: 'q'. in /Users/jneel/Sites/work/example-website/web/core/modules/jsonapi/src/EventSubscriber/JsonApiRequestValidator.php:78\nStack trace:\n#0 /Users/jneel/Sites/work/example-website/web/core/modules/jsonapi/src/EventSubscriber/JsonApiRequestValidator.php(36): Drupal\\jsonapi\\EventSubscriber\\JsonApiRequestValidator->validateQueryParams(Object(Symfony\\Component\\HttpFoundation\\Request))\n#1 [internal function]: Drupal\\jsonapi\\EventSubscriber\\JsonApiRequestValidator->onRequest(Object(Symfony\\Component\\HttpKernel\\Event\\RequestEvent), 'kernel.request', Object(Drupal\\Component\\EventDispatcher\\ContainerAwareEventDispatcher))\n#2 /Users/jneel/Sites/work/example-website/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func(Array, Object(Symfony\\Component\\HttpKernel\\Event\\RequestEvent), 'kernel.request', Object(Drupal\\Component\\EventDispatcher\\ContainerAwareEventDispatcher))\n#3 /Users/jneel/Sites/work/example-website/vendor/symfony/http-kernel/HttpKernel.php(134): Drupal\\Component\\EventDispatcher\\ContainerAwareEventDispatcher->dispatch(Object(Symfony\\Component\\HttpKernel\\Event\\RequestEvent), 'kernel.request')\n#4 /Users/jneel/Sites/work/example-website/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#5 /Users/jneel/Sites/work/example-website/web/modules/contrib/simple_oauth/src/HttpMiddleware/BasicAuthSwap.php(67): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#6 /Users/jneel/Sites/work/example-website/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Drupal\\simple_oauth\\HttpMiddleware\\BasicAuthSwap->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#7 /Users/jneel/Sites/work/example-website/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\\Core\\StackMiddleware\\Session->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#8 /Users/jneel/Sites/work/example-website/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#9 /Users/jneel/Sites/work/example-website/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\\page_cache\\StackMiddleware\\PageCache->pass(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#10 /Users/jneel/Sites/work/example-website/vendor/asm89/stack-cors/src/Asm89/Stack/Cors.php(49): Drupal\\page_cache\\StackMiddleware\\PageCache->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#11 /Users/jneel/Sites/work/example-website/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Asm89\\Stack\\Cors->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#12 /Users/jneel/Sites/work/example-website/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#13 /Users/jneel/Sites/work/example-website/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#14 /Users/jneel/Sites/work/example-website/web/core/lib/Drupal/Core/DrupalKernel.php(709): Stack\\StackedHttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#15 /Users/jneel/Sites/work/example-website/web/index.php(19): Drupal\\Core\\DrupalKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#16 /Users/jneel/.composer/vendor/laravel/valet/server.php(234): require('/Users/jneel/Si...')\n#17 {main}",
        "trace": [
          {
            "file": "/Users/jneel/Sites/work/example-website/web/core/modules/jsonapi/src/EventSubscriber/JsonApiRequestValidator.php",
            "line": 36,
            "function": "validateQueryParams",
            "class": "Drupal\\jsonapi\\EventSubscriber\\JsonApiRequestValidator",
            "type": "->",
            "args": [
              "GET /jsonapi HTTP/2.0\r\nAccept:                    text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\nAccept-Encoding:           gzip, deflate, br\r\nAccept-Language:           en-US;q=0.9\r\nCache-Control:             max-age=0\r\nContent-Length:            \r\nContent-Type:              \r\nCookie:                    XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2%2CnaV4%2CE6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\nHost:                      exampleusa.test\r\nSec-Fetch-Dest:            document\r\nSec-Fetch-Mode:            navigate\r\nSec-Fetch-Site:            none\r\nSec-Fetch-User:            ?1\r\nSec-Gpc:                   1\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent:                Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36\r\nX-Php-Ob-Level:            1\r\nCookie: XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2,naV4,E6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\n\r\n"
            ]
          },
          {
            "function": "onRequest",
            "class": "Drupal\\jsonapi\\EventSubscriber\\JsonApiRequestValidator",
            "type": "->",
            "args": [
              null,
              "kernel.request",
              null
            ]
          },
          {
            "file": "/Users/jneel/Sites/work/example-website/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php",
            "line": 142,
            "function": "call_user_func",
            "args": [
              [
                null,
                "onRequest"
              ],
              null,
              "kernel.request",
              null
            ]
          },
          {
            "file": "/Users/jneel/Sites/work/example-website/vendor/symfony/http-kernel/HttpKernel.php",
            "line": 134,
            "function": "dispatch",
            "class": "Drupal\\Component\\EventDispatcher\\ContainerAwareEventDispatcher",
            "type": "->",
            "args": [
              null,
              "kernel.request"
            ]
          },
          {
            "file": "/Users/jneel/Sites/work/example-website/vendor/symfony/http-kernel/HttpKernel.php",
            "line": 80,
            "function": "handleRaw",
            "class": "Symfony\\Component\\HttpKernel\\HttpKernel",
            "type": "->",
            "args": [
              "GET /jsonapi HTTP/2.0\r\nAccept:                    text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\nAccept-Encoding:           gzip, deflate, br\r\nAccept-Language:           en-US;q=0.9\r\nCache-Control:             max-age=0\r\nContent-Length:            \r\nContent-Type:              \r\nCookie:                    XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2%2CnaV4%2CE6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\nHost:                      exampleusa.test\r\nSec-Fetch-Dest:            document\r\nSec-Fetch-Mode:            navigate\r\nSec-Fetch-Site:            none\r\nSec-Fetch-User:            ?1\r\nSec-Gpc:                   1\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent:                Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36\r\nX-Php-Ob-Level:            1\r\nCookie: XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2,naV4,E6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\n\r\n",
              1
            ]
          },
          {
            "file": "/Users/jneel/Sites/work/example-website/web/modules/contrib/simple_oauth/src/HttpMiddleware/BasicAuthSwap.php",
            "line": 67,
            "function": "handle",
            "class": "Symfony\\Component\\HttpKernel\\HttpKernel",
            "type": "->",
            "args": [
              "GET /jsonapi HTTP/2.0\r\nAccept:                    text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\nAccept-Encoding:           gzip, deflate, br\r\nAccept-Language:           en-US;q=0.9\r\nCache-Control:             max-age=0\r\nContent-Length:            \r\nContent-Type:              \r\nCookie:                    XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2%2CnaV4%2CE6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\nHost:                      exampleusa.test\r\nSec-Fetch-Dest:            document\r\nSec-Fetch-Mode:            navigate\r\nSec-Fetch-Site:            none\r\nSec-Fetch-User:            ?1\r\nSec-Gpc:                   1\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent:                Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36\r\nX-Php-Ob-Level:            1\r\nCookie: XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2,naV4,E6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\n\r\n",
              1,
              true
            ]
          },
          {
            "file": "/Users/jneel/Sites/work/example-website/web/core/lib/Drupal/Core/StackMiddleware/Session.php",
            "line": 58,
            "function": "handle",
            "class": "Drupal\\simple_oauth\\HttpMiddleware\\BasicAuthSwap",
            "type": "->",
            "args": [
              "GET /jsonapi HTTP/2.0\r\nAccept:                    text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\nAccept-Encoding:           gzip, deflate, br\r\nAccept-Language:           en-US;q=0.9\r\nCache-Control:             max-age=0\r\nContent-Length:            \r\nContent-Type:              \r\nCookie:                    XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2%2CnaV4%2CE6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\nHost:                      exampleusa.test\r\nSec-Fetch-Dest:            document\r\nSec-Fetch-Mode:            navigate\r\nSec-Fetch-Site:            none\r\nSec-Fetch-User:            ?1\r\nSec-Gpc:                   1\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent:                Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36\r\nX-Php-Ob-Level:            1\r\nCookie: XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2,naV4,E6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\n\r\n",
              1,
              true
            ]
          },
          {
            "file": "/Users/jneel/Sites/work/example-website/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php",
            "line": 48,
            "function": "handle",
            "class": "Drupal\\Core\\StackMiddleware\\Session",
            "type": "->",
            "args": [
              "GET /jsonapi HTTP/2.0\r\nAccept:                    text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\nAccept-Encoding:           gzip, deflate, br\r\nAccept-Language:           en-US;q=0.9\r\nCache-Control:             max-age=0\r\nContent-Length:            \r\nContent-Type:              \r\nCookie:                    XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2%2CnaV4%2CE6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\nHost:                      exampleusa.test\r\nSec-Fetch-Dest:            document\r\nSec-Fetch-Mode:            navigate\r\nSec-Fetch-Site:            none\r\nSec-Fetch-User:            ?1\r\nSec-Gpc:                   1\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent:                Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36\r\nX-Php-Ob-Level:            1\r\nCookie: XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2,naV4,E6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\n\r\n",
              1,
              true
            ]
          },
          {
            "file": "/Users/jneel/Sites/work/example-website/web/core/modules/page_cache/src/StackMiddleware/PageCache.php",
            "line": 106,
            "function": "handle",
            "class": "Drupal\\Core\\StackMiddleware\\KernelPreHandle",
            "type": "->",
            "args": [
              "GET /jsonapi HTTP/2.0\r\nAccept:                    text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\nAccept-Encoding:           gzip, deflate, br\r\nAccept-Language:           en-US;q=0.9\r\nCache-Control:             max-age=0\r\nContent-Length:            \r\nContent-Type:              \r\nCookie:                    XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2%2CnaV4%2CE6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\nHost:                      exampleusa.test\r\nSec-Fetch-Dest:            document\r\nSec-Fetch-Mode:            navigate\r\nSec-Fetch-Site:            none\r\nSec-Fetch-User:            ?1\r\nSec-Gpc:                   1\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent:                Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36\r\nX-Php-Ob-Level:            1\r\nCookie: XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2,naV4,E6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\n\r\n",
              1,
              true
            ]
          },
          {
            "file": "/Users/jneel/Sites/work/example-website/web/core/modules/page_cache/src/StackMiddleware/PageCache.php",
            "line": 85,
            "function": "pass",
            "class": "Drupal\\page_cache\\StackMiddleware\\PageCache",
            "type": "->",
            "args": [
              "GET /jsonapi HTTP/2.0\r\nAccept:                    text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\nAccept-Encoding:           gzip, deflate, br\r\nAccept-Language:           en-US;q=0.9\r\nCache-Control:             max-age=0\r\nContent-Length:            \r\nContent-Type:              \r\nCookie:                    XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2%2CnaV4%2CE6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\nHost:                      exampleusa.test\r\nSec-Fetch-Dest:            document\r\nSec-Fetch-Mode:            navigate\r\nSec-Fetch-Site:            none\r\nSec-Fetch-User:            ?1\r\nSec-Gpc:                   1\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent:                Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36\r\nX-Php-Ob-Level:            1\r\nCookie: XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2,naV4,E6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\n\r\n",
              1,
              true
            ]
          },
          {
            "file": "/Users/jneel/Sites/work/example-website/vendor/asm89/stack-cors/src/Asm89/Stack/Cors.php",
            "line": 49,
            "function": "handle",
            "class": "Drupal\\page_cache\\StackMiddleware\\PageCache",
            "type": "->",
            "args": [
              "GET /jsonapi HTTP/2.0\r\nAccept:                    text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\nAccept-Encoding:           gzip, deflate, br\r\nAccept-Language:           en-US;q=0.9\r\nCache-Control:             max-age=0\r\nContent-Length:            \r\nContent-Type:              \r\nCookie:                    XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2%2CnaV4%2CE6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\nHost:                      exampleusa.test\r\nSec-Fetch-Dest:            document\r\nSec-Fetch-Mode:            navigate\r\nSec-Fetch-Site:            none\r\nSec-Fetch-User:            ?1\r\nSec-Gpc:                   1\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent:                Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36\r\nX-Php-Ob-Level:            1\r\nCookie: XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2,naV4,E6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\n\r\n",
              1,
              true
            ]
          },
          {
            "file": "/Users/jneel/Sites/work/example-website/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php",
            "line": 48,
            "function": "handle",
            "class": "Asm89\\Stack\\Cors",
            "type": "->",
            "args": [
              "GET /jsonapi HTTP/2.0\r\nAccept:                    text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\nAccept-Encoding:           gzip, deflate, br\r\nAccept-Language:           en-US;q=0.9\r\nCache-Control:             max-age=0\r\nContent-Length:            \r\nContent-Type:              \r\nCookie:                    XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2%2CnaV4%2CE6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\nHost:                      exampleusa.test\r\nSec-Fetch-Dest:            document\r\nSec-Fetch-Mode:            navigate\r\nSec-Fetch-Site:            none\r\nSec-Fetch-User:            ?1\r\nSec-Gpc:                   1\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent:                Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36\r\nX-Php-Ob-Level:            1\r\nCookie: XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2,naV4,E6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\n\r\n",
              1,
              true
            ]
          },
          {
            "file": "/Users/jneel/Sites/work/example-website/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php",
            "line": 51,
            "function": "handle",
            "class": "Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware",
            "type": "->",
            "args": [
              "GET /jsonapi HTTP/2.0\r\nAccept:                    text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\nAccept-Encoding:           gzip, deflate, br\r\nAccept-Language:           en-US;q=0.9\r\nCache-Control:             max-age=0\r\nContent-Length:            \r\nContent-Type:              \r\nCookie:                    XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2%2CnaV4%2CE6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\nHost:                      exampleusa.test\r\nSec-Fetch-Dest:            document\r\nSec-Fetch-Mode:            navigate\r\nSec-Fetch-Site:            none\r\nSec-Fetch-User:            ?1\r\nSec-Gpc:                   1\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent:                Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36\r\nX-Php-Ob-Level:            1\r\nCookie: XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2,naV4,E6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\n\r\n",
              1,
              true
            ]
          },
          {
            "file": "/Users/jneel/Sites/work/example-website/vendor/stack/builder/src/Stack/StackedHttpKernel.php",
            "line": 23,
            "function": "handle",
            "class": "Drupal\\Core\\StackMiddleware\\NegotiationMiddleware",
            "type": "->",
            "args": [
              "GET /jsonapi HTTP/2.0\r\nAccept:                    text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\nAccept-Encoding:           gzip, deflate, br\r\nAccept-Language:           en-US;q=0.9\r\nCache-Control:             max-age=0\r\nContent-Length:            \r\nContent-Type:              \r\nCookie:                    XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2%2CnaV4%2CE6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\nHost:                      exampleusa.test\r\nSec-Fetch-Dest:            document\r\nSec-Fetch-Mode:            navigate\r\nSec-Fetch-Site:            none\r\nSec-Fetch-User:            ?1\r\nSec-Gpc:                   1\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent:                Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36\r\nX-Php-Ob-Level:            1\r\nCookie: XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2,naV4,E6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\n\r\n",
              1,
              true
            ]
          },
          {
            "file": "/Users/jneel/Sites/work/example-website/web/core/lib/Drupal/Core/DrupalKernel.php",
            "line": 709,
            "function": "handle",
            "class": "Stack\\StackedHttpKernel",
            "type": "->",
            "args": [
              "GET /jsonapi HTTP/2.0\r\nAccept:                    text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\nAccept-Encoding:           gzip, deflate, br\r\nAccept-Language:           en-US;q=0.9\r\nCache-Control:             max-age=0\r\nContent-Length:            \r\nContent-Type:              \r\nCookie:                    XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2%2CnaV4%2CE6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\nHost:                      exampleusa.test\r\nSec-Fetch-Dest:            document\r\nSec-Fetch-Mode:            navigate\r\nSec-Fetch-Site:            none\r\nSec-Fetch-User:            ?1\r\nSec-Gpc:                   1\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent:                Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36\r\nX-Php-Ob-Level:            1\r\nCookie: XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2,naV4,E6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\n\r\n",
              1,
              true
            ]
          },
          {
            "file": "/Users/jneel/Sites/work/example-website/web/index.php",
            "line": 19,
            "function": "handle",
            "class": "Drupal\\Core\\DrupalKernel",
            "type": "->",
            "args": [
              "GET /jsonapi HTTP/2.0\r\nAccept:                    text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\nAccept-Encoding:           gzip, deflate, br\r\nAccept-Language:           en-US;q=0.9\r\nCache-Control:             max-age=0\r\nContent-Length:            \r\nContent-Type:              \r\nCookie:                    XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2%2CnaV4%2CE6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\nHost:                      exampleusa.test\r\nSec-Fetch-Dest:            document\r\nSec-Fetch-Mode:            navigate\r\nSec-Fetch-Site:            none\r\nSec-Fetch-User:            ?1\r\nSec-Gpc:                   1\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent:                Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36\r\nX-Php-Ob-Level:            1\r\nCookie: XDEBUG_SESSION=PHPSTORM; SSESSc7c0d3ec9b8815ee5558696c73c5f061=bU3Gr-Oy4F8GVvxHLTEF01eeI2,naV4,E6QnS6yD9yLceIpr; ssi--sessionId=47e37aef-c06b-c03b-4334-db2fe6f05a0c\r\n\r\n"
            ]
          },
          {
            "file": "/Users/jneel/.composer/vendor/laravel/valet/server.php",
            "line": 234,
            "args": [
              "/Users/jneel/Sites/work/example-website/web/index.php"
            ],
            "function": "require"
          }
        ]
      }
    }
  ]
}

@shadcn
Copy link
Collaborator

shadcn commented Jun 28, 2022

I use Valet as well. This might help laravel/valet#771

I’m not at my desk right now. I can send my valet config when I get back.

@xpersonas
Copy link
Author

Well, I went through everything I could with that link. Never really ended up in a better place. I can get /jsonapi not to show an error now, but still not connecting the front and back ends.

I can verify that /jsonapi/node/article does list my articles. Testing with browser and Postman, I get results.

So I'm thinking jsonapi is fine on the Drupal side. But still getting nowhere on the Next.js side. I'm happy to provide any and all detail that you might request. I'm feeling a little lost here. Not new to Drupal at all. Just not sure what's killing the connection here.

URL: /jsonapi

{
  "jsonapi": {
    "version": "1.0",
    "meta": {
      "links": {
        "self": {
          "href": "http://jsonapi.org/format/1.0/"
        }
      }
    }
  },
  "data": [],
  "meta": {
    "links": {
      "me": {
        "meta": {
          "id": "0d0a9af4-8573-40f8-943b-b5282d802b04"
        },
        "href": "http://example.test/jsonapi/user/user/0d0a9af4-8573-40f8-943b-b5282d802b04"
      }
    }
  },
  "links": {
    "action--action": {
      "href": "http://example.test/jsonapi/action/action"
    },
    "base_field_override--base_field_override": {
      "href": "http://example.test/jsonapi/base_field_override/base_field_override"
    },
    "block--block": {
      "href": "http://example.test/jsonapi/block/block"
    },
    "block_content--basic": {
      "href": "http://example.test/jsonapi/block_content/basic"
    },
    "block_content_type--block_content_type": {
      "href": "http://example.test/jsonapi/block_content_type/block_content_type"
    },
    "comment--comment": {
      "href": "http://example.test/jsonapi/comment/comment"
    },
    "comment_type--comment_type": {
      "href": "http://example.test/jsonapi/comment_type/comment_type"
    },
    "consumer--consumer": {
      "href": "http://example.test/jsonapi/consumer/consumer"
    },
    "contact_form--contact_form": {
      "href": "http://example.test/jsonapi/contact_form/contact_form"
    },
    "contact_message--feedback": {
      "href": "http://example.test/jsonapi/contact_message/feedback"
    },
    "contact_message--personal": {
      "href": "http://example.test/jsonapi/contact_message/personal"
    },
    "date_format--date_format": {
      "href": "http://example.test/jsonapi/date_format/date_format"
    },
    "editor--editor": {
      "href": "http://example.test/jsonapi/editor/editor"
    },
    "entity_form_display--entity_form_display": {
      "href": "http://example.test/jsonapi/entity_form_display/entity_form_display"
    },
    "entity_form_mode--entity_form_mode": {
      "href": "http://example.test/jsonapi/entity_form_mode/entity_form_mode"
    },
    "entity_view_display--entity_view_display": {
      "href": "http://example.test/jsonapi/entity_view_display/entity_view_display"
    },
    "entity_view_mode--entity_view_mode": {
      "href": "http://example.test/jsonapi/entity_view_mode/entity_view_mode"
    },
    "field_config--field_config": {
      "href": "http://example.test/jsonapi/field_config/field_config"
    },
    "field_storage_config--field_storage_config": {
      "href": "http://example.test/jsonapi/field_storage_config/field_storage_config"
    },
    "file--file": {
      "href": "http://example.test/jsonapi/file/file"
    },
    "filter_format--filter_format": {
      "href": "http://example.test/jsonapi/filter_format/filter_format"
    },
    "image_style--image_style": {
      "href": "http://example.test/jsonapi/image_style/image_style"
    },
    "menu--menu": {
      "href": "http://example.test/jsonapi/menu/menu"
    },
    "menu_link_content--menu_link_content": {
      "href": "http://example.test/jsonapi/menu_link_content/menu_link_content"
    },
    "next_entity_type_config--next_entity_type_config": {
      "href": "http://example.test/jsonapi/next_entity_type_config/next_entity_type_config"
    },
    "next_site--next_site": {
      "href": "http://example.test/jsonapi/next_site/next_site"
    },
    "node--article": {
      "href": "http://example.test/jsonapi/node/article"
    },
    "node--page": {
      "href": "http://example.test/jsonapi/node/page"
    },
    "node_type--node_type": {
      "href": "http://example.test/jsonapi/node_type/node_type"
    },
    "oauth2_token--access_token": {
      "href": "http://example.test/jsonapi/oauth2_token/access_token"
    },
    "oauth2_token--auth_code": {
      "href": "http://example.test/jsonapi/oauth2_token/auth_code"
    },
    "oauth2_token--refresh_token": {
      "href": "http://example.test/jsonapi/oauth2_token/refresh_token"
    },
    "oauth2_token_type--oauth2_token_type": {
      "href": "http://example.test/jsonapi/oauth2_token_type/oauth2_token_type"
    },
    "path_alias--path_alias": {
      "href": "http://example.test/jsonapi/path_alias/path_alias"
    },
    "pathauto_pattern--pathauto_pattern": {
      "href": "http://example.test/jsonapi/pathauto_pattern/pathauto_pattern"
    },
    "rdf_mapping--rdf_mapping": {
      "href": "http://example.test/jsonapi/rdf_mapping/rdf_mapping"
    },
    "search_page--search_page": {
      "href": "http://example.test/jsonapi/search_page/search_page"
    },
    "self": {
      "href": "http://example.test/jsonapi"
    },
    "shortcut--default": {
      "href": "http://example.test/jsonapi/shortcut/default"
    },
    "shortcut_set--shortcut_set": {
      "href": "http://example.test/jsonapi/shortcut_set/shortcut_set"
    },
    "taxonomy_term--tags": {
      "href": "http://example.test/jsonapi/taxonomy_term/tags"
    },
    "taxonomy_vocabulary--taxonomy_vocabulary": {
      "href": "http://example.test/jsonapi/taxonomy_vocabulary/taxonomy_vocabulary"
    },
    "tour--tour": {
      "href": "http://example.test/jsonapi/tour/tour"
    },
    "user--user": {
      "href": "http://example.test/jsonapi/user/user"
    },
    "user_role--user_role": {
      "href": "http://example.test/jsonapi/user_role/user_role"
    },
    "view--view": {
      "href": "http://example.test/jsonapi/view/view"
    }
  }
}

Composer.json

{
    "name": "drupal/recommended-project",
    "description": "Project template for Drupal 9 projects with a relocated document root",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "homepage": "https://www.drupal.org/project/drupal",
    "support": {
        "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
        "chat": "https://www.drupal.org/node/314178"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "composer/installers": "^1.9",
        "cweagans/composer-patches": "^1.7",
        "drupal/core-composer-scaffold": "^9.4",
        "drupal/core-project-message": "^9.4",
        "drupal/core-recommended": "^9.4",
        "drupal/next": "^1.2",
        "drush/drush": "^11.0"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "stable",
    "prefer-stable": true,
    "config": {
        "sort-packages": true,
        "allow-plugins": {
            "composer/installers": true,
            "drupal/core-composer-scaffold": true,
            "drupal/core-project-message": true,
            "cweagans/composer-patches": true
        }
    },
    "extra": {
        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
            }
        },
        "installer-paths": {
            "web/core": [
                "type:drupal-core"
            ],
            "web/libraries/{$name}": [
                "type:drupal-library"
            ],
            "web/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "web/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "web/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/Commands/contrib/{$name}": [
                "type:drupal-drush"
            ],
            "web/modules/custom/{$name}": [
                "type:drupal-custom-module"
            ],
            "web/profiles/custom/{$name}": [
                "type:drupal-custom-profile"
            ],
            "web/themes/custom/{$name}": [
                "type:drupal-custom-theme"
            ]
        },
        "patches": {
            "drupal/subrequests": {
                "Get same results on different request": "https://www.drupal.org/files/issues/2019-07-18/change_request_type-63049395-09.patch"
            },
            "drupal/decoupled_router": {
                "Unable to resolve path on node in other language than default": "https://www.drupal.org/files/issues/2021-05-05/3111456-34.patch"
            }
        },
        "drupal-core-project-message": {
            "include-keys": [
                "homepage",
                "support"
            ],
            "post-create-project-cmd-message": [
                "<bg=blue;fg=white>                                                         </>",
                "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
                "<bg=blue;fg=white>  from the drupal/recommended-project template!          </>",
                "<bg=blue;fg=white>                                                         </>",
                "",
                "<bg=yellow;fg=black>Next steps</>:",
                "  * Install the site: https://www.drupal.org/docs/8/install",
                "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                "  * Get support: https://www.drupal.org/support",
                "  * Get involved with the Drupal community:",
                "      https://www.drupal.org/getting-involved",
                "  * Remove the plugin that prints this message:",
                "      composer remove drupal/core-project-message"
            ]
        }
    }
}

Package.json

{
  "name": "basic-starter",
  "version": "1.5.3-rc.1",
  "private": true,
  "license": "MIT",
  "scripts": {
    "dev": "next dev",
    "preview": "next build && next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@tailwindcss/typography": "^0.5.2",
    "next": "^12.1.4",
    "next-drupal": "^1.4.0-rc.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.2"
  },
  "devDependencies": {
    "@types/node": "^17.0.23",
    "@types/react": "^17.0.43",
    "autoprefixer": "^10.4.4",
    "eslint": "^8.12.0",
    "eslint-config-next": "^12.1.4",
    "postcss": "^8.4.12",
    "tailwindcss": "^3.0.23",
    "typescript": "^4.5.5"
  }
}

@shadcn
Copy link
Collaborator

shadcn commented Jun 30, 2022

Still not sure what could be happening here. It looks like you got everything properly configured. Looking...

@shadcn shadcn self-assigned this Jun 30, 2022
@shadcn
Copy link
Collaborator

shadcn commented Jun 30, 2022

@xpersonas I have a Drupal site set up here: https://dev-next-drupal.pantheonsite.io

Can you update your .env.local file with the following and try npm run build?

NEXT_PUBLIC_DRUPAL_BASE_URL=https://dev-next-drupal.pantheonsite.io
NEXT_IMAGE_DOMAIN=dev-next-drupal.pantheonsite.io

@xpersonas
Copy link
Author

Thank you for the proof of concept here. That worked perfectly. I still couldn't get my test site to load. So I created another drupal installation and it finally worked. That was my third one. I can't figure out why the first two wouldn't have worked. I didn't do anything different.

Once I had that working, I tried connecting to a couple of pre-existing sites. One worked. One didn't. Both have an article content type. I have no idea what the difference could be. Bizarre. But at least I have something working now and can dig in. If I find what was tripping me up before I'll post that info here. But I'll close this issue now.

Thanks again for taking the time to verify that I didn't have any glaring configuration issues and providing that test site.

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

No branches or pull requests

2 participants