Error: Internal server error
I'm trying to set up a local Drupal installation with this module. Everything works, but when it's time to launch the site, I receive this, and I can't get to wrap my head around it. Any idea what's wrong or what I can do to get the local server up and running?
Server Error Error: Internal Server Error This error happened while generating the page. Any console logs will be displayed in the terminal window.

Using XAMPP, Drupal 9.3.2.
Anything in the Drupal logs? A server error is usually something went wrong on the Drupal side. Can you check the log and see? Does the site build yarn build?
Quick answer, thank you.
The Drupal logs gave me enough information to find this issue: https://github.com/chapter-three/next-drupal/issues/15 in which I got the lead of "tokens". The Quick start guide doesn't go through the tokens, which is a bit sad, because that could have saved me some time debugging.
Looking for a way to get these tokens. I'm just a site-builder, and I haven't found an easy way to generate these tokens yet. If you have an easy guide of generating those, I'm happy to follow it.
did you see the short video guide? https://next-drupal.org/learn/quick-start/create-role
Does this help?
I’ll work on improving the access tokens documentation.
Yes, the videos are short and great, but the steps with tokens are missing. Perhaps that's a thing that an avid developer knows about, but for me, no. I don't know how to create tokens, and I didn't even know I needed them.
In context. I've been looking at NextJS for some time, but it was only when ChapterThree launched their Next-drupal.org-site that I thought it would be possible for me to start looking at it, all other guides were too long, too hard or similiar. And the steps are wonderful; short, to the point. And everything worked like a charm, until it was time to see the result. After that; extensive problem solving. So if information about tokens could be added, that would be super.
Anyway, thank you for everything, answers and the guide/site. I'm postponing my exploratory work for some days, need to attend other things, and I'll see if I'll give NextJS a new go.
// Adam
I understand. Configuring access token takes some work/configuration right now.
Note that you don't need to manually create the tokens. You create a client/consumer and copy and paste the client id and secret into your .env file.
Which part specifically was a blocker for you? I want to improve the docs to make this easier.
Thanks for the feedback.
It seems like you're describing keys. Am I wrong? I'm talking about tokens, the ones that should wind up on /admin/config/people/simple_oauth/oauth2_token After finding https://github.com/chapter-three/next-drupal/issues/15 I came to the conclusion that it's the tokens that are missing and that I lack the knowledge/guides how to generate them to make the stuff work.
Two things made the NextJS journey by ChapterThree troublesome for me. I mixed up secret, uuid and passwords, so my first attempt to set everything up didn't go so well. When I tried npm run dev I just got "Error: Specified images.domains should be an Array of strings received invalid values ()." That took some time to figure out that all the information in .env.local didn't add up. At recreating those steps I got to where I am now, with missing tokens to make the authentication work. The tokens are the second bump in the road for me.
Also, but that's not on you, I didn't have npm installed, so I had to look that up and install it.
What development environment are you running Drupal on? Docker, ddev, Laravel Valet? I'll see if I can reproduce this issue.
I'm running XAMPP 8.0.11-2 (which, I must confess I thought would be an obstacle when working with NextJS, but it turned out well).
I do face the same issue.
@besrabasant Where are you blocked? With the access tokens?
Yes, How do I generate them?
Btw I get this error

@shadcn Any probable solution for this issue?
@besrabasant Can you try the following https://github.com/chapter-three/next-drupal/issues/15#issuecomment-899808977?
Are you on XAMPP as well?
I Already tried that but found no success. I am on laravel valet.
I’m on Valet as well. Are you on https?
No.
@besrabasant any thing in the drupal logs?
I'm running my site on Valet as well. Here's what I have:
- Drupal sites running at
http://drupal.test. - Next.js site at
http://localhost:3000
with the following in my .env.local
NEXT_PUBLIC_BASE_URL=http://localhost:3000
NEXT_PUBLIC_DRUPAL_BASE_URL=http://drupal.test
NEXT_IMAGE_DOMAIN=drupal.test
DRUPAL_FRONT_PAGE=/home
DRUPAL_PREVIEW_SECRET=YEuHnbkd
DRUPAL_CLIENT_ID=f0174559-7b6a-43b3-9d62-05ba4956f271
DRUPAL_CLIENT_SECRET=4WHnh3AM7gee
Here are my env variables
NEXT_PUBLIC_DRUPAL_BASE_URL=http://drupal9.test
NEXT_IMAGE_DOMAIN=drupal9.test
DRUPAL_SITE_ID=drupal_next
DRUPAL_FRONT_PAGE=/home
DRUPAL_PREVIEW_SECRET=secret
DRUPAL_CLIENT_ID=1923f3de-fe47-455e-9871-4f803afaf9ce
DRUPAL_CLIENT_SECRET=password
here is my demo drupal installation https://github.com/besrabasant/druapl9
@besrabasant I created a tool here to debug the connection. Can you try it and report back? See https://github.com/shadcn/next-drupal-debug
@besrabasant any luck?
@shadcn I tested the connection with the tool and I see Connection Established successfully

I get the same error here, clean install, I followed all the steps in the guide: https://next-drupal.org/learn/quick-start/install-drupal https://next-drupal.org/docs/quick-start
I checked the logs, and I didn't have any type of error. https://i.imgur.com/lxRywUl.gif

@solucionti Looking into it. This is a fresh Drupal install?
Hello, @shadcn , yes it is a clean installation
@solucionti @besrabasant I'm pretty sure you've already done this but could you go through the following checklist and make sure everything is set up correctly? (I'm trying to reproduce the bug).
- [ ] Apply Patches for subrequests and decoupled_router
- [ ] Enable both Next.js and Next.js JSON:API modules
- [ ] Create a role and a user with the proper permissions
- [ ] Create consumer
- [ ] Configure path patterns/aliases for the entity types (article node type)
Thank you.
Yes @solucionti, I have performed all the configurations you have listed above
- [x] Apply Patches for subrequests and decoupled_router
- [x] Enable both Next.js and Next.js JSON:API modules
- [x] Create a role and a user with the proper permissions
- [x] Create consumer
- [x] Configure path patterns/aliases for the entity types (article node type)
As also mentioned in the documentation.
Ok @shadcn , today I will do a clean install. As soon as I have news I will send it to you.
@shadcn I did a clean installation on two computers, on one it worked without problem, on the other at the time of installation using the command:
npx create-next-app -e https://github.com/chapter-three/next-drupal-basic-starter
I get the following warnign messages:
l v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
info @next/[email protected]: The platform "linux" is incompatible with this module.
info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/[email protected]: The platform "linux" is incompatible with this module.
info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
info @next/[email protected]: The platform "linux" is incompatible with this module.
info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/[email protected]: The platform "linux" is incompatible with this module.
info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
info @next/[email protected]: The platform "linux" is incompatible with this module.
info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
info @next/[email protected]: The CPU architecture "x64" is incompatible with this module.
info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/[email protected]: The platform "linux" is incompatible with this module.
info "@next/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 9.16s.

This is the error on the failing computer:

I was running into similar problem when installing next-drupal on top of composer.json from Drupal Core and running PHP 8.0. The problem is caused by having PHP constraint on composer.json to require packages that support PHP 7.3.0, while running PHP 8.0 locally. The PHP 7.3.0 constraint in composer.json prevents composer from loading Simple OAuth 5.2.0 which is the version that makes the module compatible with PHP 8.0. Because Simple OAuth 5.2.0 isn't compatible with PHP 7.3.0 which is the version constraint in composer.json, composer loaded Simple OAuth 5.1.0 instead which isn't compatible with PHP 8.0.
The solution is to either downgrade PHP version to PHP 7.4, or remove the version constraint from composer.json:
@@ -45,9 +47,6 @@
"config": {
"preferred-install": "dist",
"autoloader-suffix": "Drupal9",
- "platform": {
- "php": "7.3.0"
- },