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

Issue logging in to Umami site

Open 2dareis2do opened this issue 1 year ago • 4 comments

I have followed the instruction here more or less verbatim with the exception of generating the cert and key which cannot be saved in sites/default/files as that is a public directory. In stead I have in stalled in sites/default/file/private as per the bundled profile.

https://next-drupal.org/guides/umami-demo

I am using the example-umami that comes bundled with the next-drupal code base

I am able to set up everything ok, i.e. have next pointed to Drupal and it displays site.

However when I try to login in I am getting the following error

Load failed error - unhandledRejection: Error: aborted at connResetException (node:internal/errors:705:14) at abortIncoming (node:_http_server:642:17) at socketOnClose (node:_http_server:636:3) at Socket.emit (node:events:525:35) at TCP.<anonymous> (node:net:301:12) { code: 'ECONNRESET' } event - compiled client and server successfully in 416 ms (500 modules) error - FetchError: request to http://localhost:8888/jsonapi/menu_items/main?fields%5Bmenu_link_content--menu_link_content%5D=title%2Curl failed, reason: read ECONNRESET at ClientRequest.<anonymous> (/Users/myuser/Sites/next-drupal/node_modules/next/dist/compiled/node-fetch/index.js:1:65763) at ClientRequest.emit (node:events:513:28) at Socket.socketErrorListener (node:_http_client:494:9) at Socket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) { type: 'system', errno: 'ECONNRESET', code: 'ECONNRESET', page: '/articles/new' } error - FetchError: request to http://localhost:8888/jsonapi/menu_items/main?fields%5Bmenu_link_content--menu_link_content%5D=title%2Curl failed, reason: read ECONNRESET at ClientRequest.<anonymous> (/Users/myuser/Sites/next-drupal/node_modules/next/dist/compiled/node-fetch/index.js:1:65763) at ClientRequest.emit (node:events:513:28) at Socket.socketErrorListener (node:_http_client:494:9) at Socket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) { type: 'system', errno: 'ECONNRESET', code: 'ECONNRESET', page: '/login' } error - FetchError: request to http://localhost:8888/jsonapi/menu_items/main?fields%5Bmenu_link_content--menu_link_content%5D=title%2Curl failed, reason: read ECONNRESET at ClientRequest.<anonymous> (/Users/myuser/Sites/next-drupal/node_modules/next/dist/compiled/node-fetch/index.js:1:65763) at ClientRequest.emit (node:events:513:28) at Socket.socketErrorListener (node:_http_client:494:9) at Socket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) { type: 'system', errno: 'ECONNRESET', code: 'ECONNRESET', page: '/login' } error - FetchError: request to http://localhost:8888/jsonapi/menu_items/main?fields%5Bmenu_link_content--menu_link_content%5D=title%2Curl failed, reason: read ECONNRESET at ClientRequest.<anonymous> (/Users/myuser/Sites/next-drupal/node_modules/next/dist/compiled/node-fetch/index.js:1:65763) at ClientRequest.emit (node:events:513:28) at Socket.socketErrorListener (node:_http_client:494:9) at Socket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) { type: 'system', errno: 'ECONNRESET', code: 'ECONNRESET', page: '/articles/new' }

I have tried the same using next drupal debug.

I get

yarn run v1.22.19 $ node index.js ❌ Unauthorized Response { size: 0, [Symbol(Body internals)]: { body: PassThrough { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 6, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: true, [Symbol(kCapture)]: false, [Symbol(kTransformState)]: [Object] }, boundary: null, disturbed: false, error: null }, [Symbol(Response internals)]: { type: 'default', url: 'http://localhost:8888/oauth/token', status: 401, statusText: 'Unauthorized', headers: { 'cache-control': 'must-revalidate, no-cache, private', connection: 'close', 'content-language': 'en', 'content-type': 'application/json', date: [Array], expires: 'Sun, 19 Nov 1978 05:00:00 GMT', host: 'localhost:8888', 'www-authenticate': 'Basic realm="OAuth"', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-generator': 'Drupal 9 (https://www.drupal.org)', 'x-powered-by': 'PHP/8.1.17', 'x-ua-compatible': 'IE=edge' }, counter: 0, highWaterMark: 16384 } } ✨ Done in 0.44s.

Any idea what I am doing wrong? I have spent quite a lot of time trying to get this working so any help would be appreciated.

2dareis2do avatar Apr 19 '23 23:04 2dareis2do

Ok I have decided to use Drupal4Docker as this has many benefits over the quickstart setup.

  • more suited for development
  • does not hang or freeze
  • can be debugged, etc

With this in mind I have the same situation, i.e. unable to login as admin user

I will try and run the install again using the next drupal compose file, but at the moment the problem I am having is 401 error.

yarn run v1.22.19 $ node index.js ❌ Unauthorized Response { size: 0, [Symbol(Body internals)]: { body: PassThrough { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 5, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: true, [Symbol(kCapture)]: false, [Symbol(kTransformState)]: [Object] }, boundary: null, disturbed: false, error: null }, [Symbol(Response internals)]: { type: 'default', url: 'http://umami3.internal/oauth/token', status: 401, statusText: 'Unauthorized', headers: { 'cache-control': 'must-revalidate, no-cache, private', connection: 'close', 'content-language': 'en', 'content-length': '118', 'content-type': 'application/json', date: 'Thu, 20 Apr 2023 12:13:50 GMT', expires: 'Sun, 19 Nov 1978 05:00:00 GMT', server: 'nginx', vary: 'Origin', 'www-authenticate': 'Basic realm="OAuth"', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-generator': 'Drupal 10 (https://www.drupal.org)' }, counter: 0, highWaterMark: 16384 } } ✨ Done in 0.59s.

2dareis2do avatar Apr 20 '23 12:04 2dareis2do

ok I have reverted to composer.json bundled with next.drupal codebase and rebuilt, run composer update, drush updb etc and I get more or less the same result 401 unauthorised?

node index.js ❌ Unauthorized Response { size: 0, [Symbol(Body internals)]: { body: PassThrough { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 5, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: true, [Symbol(kCapture)]: false, [Symbol(kTransformState)]: [Object] }, boundary: null, disturbed: false, error: null }, [Symbol(Response internals)]: { type: 'default', url: 'http://umami3.internal/oauth/token', status: 401, statusText: 'Unauthorized', headers: { 'cache-control': 'must-revalidate, no-cache, private', connection: 'close', 'content-language': 'en', 'content-length': '118', 'content-type': 'application/json', date: 'Thu, 20 Apr 2023 13:18:23 GMT', expires: 'Sun, 19 Nov 1978 05:00:00 GMT', server: 'nginx', 'www-authenticate': 'Basic realm="OAuth"', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-generator': 'Drupal 9 (https://www.drupal.org)', 'x-ua-compatible': 'IE=edge' }, counter: 0, highWaterMark: 16384 } }

2dareis2do avatar Apr 20 '23 13:04 2dareis2do

ok turns out that if I use client_id from SImple auth and NOT UUID then everything works as expected.

2dareis2do avatar Apr 20 '23 17:04 2dareis2do

Ok tried creating a PR but I do not have access.

Here is a patch instead:

From 392b8e87cebf7a9a939ab2aef2884e0fd71f34c8 Mon Sep 17 00:00:00 2001 From: Daniel Lobo [email protected] Date: Wed, 26 Apr 2023 15:05:26 +0100 Subject: [PATCH] - update documentation to reference client_id NOT client_uuid


www/content/guides/umami-demo.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/content/guides/umami-demo.mdx b/www/content/guides/umami-demo.mdx index b339d65..ea11ece 100644 --- a/www/content/guides/umami-demo.mdx +++ b/www/content/guides/umami-demo.mdx @@ -99,7 +99,7 @@ NEXT_IMAGE_DOMAIN=localhost

  • Authentication (Bearer)

  • NEXTAUTH_SECRET=zdauNuBL7lLAHT9zIpxExCThVHSSOfIwouGOhr5cjWQ
  • NEXTAUTH_URL=http://localhost:3000 -+ DRUPAL_CLIENT_ID=YOUR_DEFAULT_CLIENT_UUID_HERE ++ DRUPAL_CLIENT_ID=YOUR_DEFAULT_CLIENT_ID_HERE
  • DRUPAL_CLIENT_SECRET=weDKc7PD845kq49JfPeYmsZ48e

-- 
2.40.0



2dareis2do avatar Apr 26 '23 14:04 2dareis2do