next-drupal icon indicating copy to clipboard operation
next-drupal copied to clipboard

Error: Internal server error

Open henlfern opened this issue 4 years ago • 46 comments

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.

Skärmavbild 2022-01-18 kl  19 05 54

Using XAMPP, Drupal 9.3.2.

henlfern avatar Jan 18 '22 18:01 henlfern

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?

shadcn avatar Jan 18 '22 18:01 shadcn

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.

henlfern avatar Jan 18 '22 20:01 henlfern

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.

shadcn avatar Jan 18 '22 22:01 shadcn

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

henlfern avatar Jan 19 '22 06:01 henlfern

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.

shadcn avatar Jan 19 '22 06:01 shadcn

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.

henlfern avatar Jan 19 '22 06:01 henlfern

What development environment are you running Drupal on? Docker, ddev, Laravel Valet? I'll see if I can reproduce this issue.

shadcn avatar Jan 19 '22 06:01 shadcn

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).

henlfern avatar Jan 19 '22 20:01 henlfern

I do face the same issue.

besrabasant avatar Jan 27 '22 06:01 besrabasant

@besrabasant Where are you blocked? With the access tokens?

shadcn avatar Jan 27 '22 06:01 shadcn

Yes, How do I generate them?

Btw I get this error image

besrabasant avatar Jan 27 '22 07:01 besrabasant

@shadcn Any probable solution for this issue?

besrabasant avatar Jan 28 '22 06:01 besrabasant

@besrabasant Can you try the following https://github.com/chapter-three/next-drupal/issues/15#issuecomment-899808977?

Are you on XAMPP as well?

shadcn avatar Jan 28 '22 06:01 shadcn

I Already tried that but found no success. I am on laravel valet.

besrabasant avatar Jan 28 '22 07:01 besrabasant

I’m on Valet as well. Are you on https?

shadcn avatar Jan 28 '22 07:01 shadcn

No.

besrabasant avatar Jan 28 '22 11:01 besrabasant

@besrabasant any thing in the drupal logs?

I'm running my site on Valet as well. Here's what I have:

  1. Drupal sites running at http://drupal.test.
  2. 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

shadcn avatar Jan 28 '22 11:01 shadcn

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 avatar Jan 28 '22 15:01 besrabasant

@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

shadcn avatar Jan 31 '22 05:01 shadcn

@besrabasant any luck?

shadcn avatar Feb 04 '22 05:02 shadcn

@shadcn I tested the connection with the tool and I see Connection Established successfully

image

besrabasant avatar Feb 04 '22 11:02 besrabasant

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

image

solucionti avatar Feb 06 '22 19:02 solucionti

@solucionti Looking into it. This is a fresh Drupal install?

shadcn avatar Feb 07 '22 06:02 shadcn

Hello, @shadcn , yes it is a clean installation

solucionti avatar Feb 07 '22 12:02 solucionti

@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).

Thank you.

shadcn avatar Feb 07 '22 17:02 shadcn

Yes @solucionti, I have performed all the configurations you have listed above

As also mentioned in the documentation.

besrabasant avatar Feb 07 '22 17:02 besrabasant

Ok @shadcn , today I will do a clean install. As soon as I have news I will send it to you.

solucionti avatar Feb 07 '22 18:02 solucionti

@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. WindowsTerminal_GMRqGemIwi

solucionti avatar Feb 08 '22 02:02 solucionti

This is the error on the failing computer: chrome_1aLVHqtKxn

solucionti avatar Feb 08 '22 03:02 solucionti

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"
-        },

lauriii avatar Feb 15 '22 09:02 lauriii