dspace-7.5. angular-ui gives no response

273 views
Skip to first unread message

Christiane Baier

unread,
May 10, 2023, 12:11:57 PM5/10/23
to DSpace Technical Support
Hi there,

I installed dspace-7.5 angular frontend on a different server, than the backend. It is a ubuntu 22.04 and I did it as outlined in the Installing the frontend section in <https://wiki.lyrasis.org/display/DSDOC7x/Installing+DSpace#InstallingDSpace-InstallingtheFrontend(UserInterface)>
I set up a apache proxy like it says in the documentation. Backend (server/api) ist reachable. 
I set up the config.prod.yml by taking the config.example.yml and changing the value for 
host: api7.dspace.org to the name of the backend server. HAL-Browser answers at https://backend-server-name/server. So this is not the problem.
I set up pm2 (like stated in the documentation) to get more logs, started the application and gave https://angular-server-name-as configured in local.cfg on Backend and apache config on angular-server-name. DNS is working.
In the browser I get an error after waiting for minutes "The proxy server received an invalid response from an upstream server.

The proxy server could not handle the request

Reason: Error reading from remote server"

and in the pm2 logs this error message shows up.

0|dspace-ui  | GET / - - ms - -

0|dspace-ui  | 1 rules skipped due to selector errors:

0|dspace-ui  |   .custom-file-input:lang(en)~.custom-file-label -> unmatched pseudo-class :lang


Can somebody tell me what is misconfigured? in config.prod.yml language is set to:
defaultLanguage: en
That is the entry in the original config.example.yml and I didn't changed it.

Kind regards
Christiane

DSpace Technical Support

unread,
May 10, 2023, 2:33:06 PM5/10/23
to DSpace Technical Support
Hi Cristiane,

In order to help, we'd need you to look for the underlying error message when you attempt to access the User Interface (or backend, depending on the problem).  Here's a troubleshooting guide with details on finding the underlying error: https://wiki.lyrasis.org/display/DSPACE/Troubleshoot+an+error#Troubleshootanerror-DSpace7.x(orabove)

We also have a list of common installation issues at the bottom of the install instructions. It's very likely you may be hitting one of these common problems (but it'd be easier to tell which one after you look for underlying errors): https://wiki.lyrasis.org/display/DSDOC7x/Installing+DSpace#InstallingDSpace-CommonInstallationIssues

If you can find more information about the underlying error, it'll be easier to help.

You also could try initially running the User Interface manually (not in PM2) just to verify your other configs are correct.  That would at least help ensure you have a correct configuration between the frontend & backend.  This is documented in step 6 of the Installation for the UI.

Tim

Michael Plate

unread,
May 11, 2023, 4:22:28 AM5/11/23
to dspac...@googlegroups.com
Hi Christiane,

Am 10.05.23 um 18:06 schrieb Christiane Baier:
> Hi there,
>
> I installed dspace-7.5 angular frontend on a different server, than the
> backend. It is a ubuntu 22.04 and I did it as outlined in the Installing
> the frontend section in
> <https://wiki.lyrasis.org/display/DSDOC7x/Installing+DSpace#InstallingDSpace-InstallingtheFrontend(UserInterface)>
> I set up a apache proxy like it says in the documentation. Backend
> (server/api) ist reachable.
> I set up the config.prod.yml by taking the config.example.yml and
> changing the value for
> host: api7.dspace.org to the name of the backend server. HAL-Browser
> answers at https://backend-server-name/server. So this is not the problem.
> I set up pm2 (like stated in the documentation) to get more logs,
> started the application and gave https://angular-server-name-as
> configured in local.cfg on Backend and apache config on
> angular-server-name. DNS is working.
> In the browser I get an error after waiting for minutes "The proxy
> server received an invalid response from an upstream server.
>
> The proxy server could not handle the request
[…]

I had this problem, too - after a reboot.
I don't know what was - is - wrong, but resolving of 127.0.0.1 <->
"localhost" did not work.
I replaced "localhost" in the config.yml by 127.0.0.1 and it worked.

Workaround, no solution…

Michael

Christiane Baier

unread,
May 11, 2023, 5:34:34 AM5/11/23
to DSpace Technical Support
Hi Tim,
I went over the troubleshooting guide, but this doesn't help as I don't get any content in the browser, so nothing to see. In the apache logs, I can see, that the host is reached: 
"GET / HTTP/1.1" 502 6753
but it hrows an error and the following is displayed in my browser:
    The proxy server received an invalid response from an upstream server.
    The proxy server could not handle the request
    Reason: Error reading from remote server
So no way to see any errors in the browser's Developer Tools.
I tried all the suggested steps in the troubleshooting section
I can reach my backend  wget -v "https://<my-backends-server-name>/server/api" and get an answer similar to the one when calling wget -v "https://api7.dspace.org/server/api"
I did yarn test:rest as suggested in "
  1. From [dspace-angular], run yarn test:rest This script will attempt a basic Node.js connection to the REST API that is configured in your "config.prod.yml" file and validate the response."
and it went well.

If I stop the app with pm2 and start it with
node ./dist/server/main.js
I get:
   Building production app config
   Overriding app config with /dspace-ui-deploy/config/config.yml
   Overriding app config with /dspace-ui-deploy/config/config.prod.yml
  Angular config.json file generated correctly at /dspace-ui-deploy/dist/browser/assets/config.json

  Environment extended with app config

  dspace-angular
  Version: 7.5.0
  Environment: Production

  [HPM] Proxy created: /  -> https://<my-backends-server-name>/server/sitemaps
  [10:35:15 GMT+0200 (Mitteleuropäische Sommerzeit)] Listening at http://localhost:4000/

But if I try to reach the site in the browser - same as before. 
console where I started main.js shows:
GET / - - ms - -
1 rules skipped due to selector errors:
  .custom-file-input:lang(en)~.custom-file-label -> unmatched pseudo-class :lang
GET /favicon.ico 404 2723.419 ms - -
I get no answer and I get nothing on the console to get a hint what is wrong.
netstat -taupe | grep 4000 
shows
tcp        0      0 localhost:4000          0.0.0.0:*               LISTEN      dspace     119606     6143/node          
tcp        0      0 localhost:60110         localhost:4000          VERBUNDEN   www-data   119839     5984/apache2        
tcp        0      0 localhost:4000          localhost:60110         VERBUNDEN   dspace     119840     6143/node

I tried the suggestion from Michael. But this doesn't change anything as the system still knows that localhost is 127.0.0.1 
In the output of netstat nothing is changed. I even changed the value in the apache config. Same. 

ipv6 is disabled on the system.
If I try
I get:
--2023-05-10 10:59:16--  http://localhost:4000/
Auflösen des Hostnamens localhost (localhost) … 127.0.0.1, ::1
Verbindungsaufbau zu localhost (localhost)|127.0.0.1|:4000 … verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … Lesefehler (Die Wartezeit für die Verbindung ist abgelaufen) beim Vorspann (header).
Erneuter Versuch.

I tried enabling mod_headers and put 
  RequestHeader set X-Forwarded-Proto https
in the default-ssl.conf of my apache. No change of behavior.

So I am completely stuck.
Kind Regards
Christiane

Christiane Baier

unread,
May 12, 2023, 3:03:25 AM5/12/23
to DSpace Technical Support
Hi there,

I decided to start with a fresh installation of the angular frontend. I have following version installed:
 npm version: 9.6.6
 yarn version: 1.22.19
 node version: v16.20.0

execpt for a new config.prod.yml in the config directory,  with the minimal configuration as stated in the install guide, nothing changed in the dspace-angular code checked out from git with tag dspace-7.5

If I do yarn install I get warnings:
  yarn install v1.22.19
  [1/4] Resolving packages...
  [2/4] Fetching packages...
  [3/4] Linking dependencies...
  warning " > boot...@4.6.2" has unmet peer dependency "jqu...@1.9.1 - 3".
  warning " > boot...@4.6.2" has unmet peer dependency "popper.js@^1.16.1".
  warning " > ngx-sor...@11.1.0" has incorrect peer dependency "@angular/common@^11.0.0".
  warning " > ngx-sor...@11.1.0" has incorrect peer dependency "@angular/core@^11.0.0".
  [4/4] Building fresh packages...
  Done in 124.82s.

Might this be the reason, why it is not working for me. How can I fix this. I am new to angular, node,js, yarn &  co

Kind regards
Christiane

DSpace Technical Support

unread,
May 17, 2023, 3:12:32 PM5/17/23
to DSpace Technical Support
Hi Christiane,

Those warnings when running "yarn install" are normal behavior.  They can be ignored. They are not causing any issues.

As I mentioned previously, you might want to try starting up the UI *without* PM2, just to verify it's working properly standalone & trying to access it on the same machine that is is running on using http://localhost:4000/.  If it works standalone, then something in your PM2 configuration is the problem.  If it doesn't work standalone, then it might give you more useful errors to work with.   As I mentioned, this is documented in step 6 of the Installation for the UI (called the "Quick Start"): https://wiki.lyrasis.org/display/DSDOC7x/Installing+DSpace#InstallingDSpace-FrontendInstallation

My best guess is that either the UI is having trouble contacting the backend... or something in your proxy configuration (in either PM2 or Apache) is incorrect and is causing things to get confused.

Tim

Christiane Baier

unread,
May 23, 2023, 3:06:07 AM5/23/23
to DSpace Technical Support
Hi Tim,

Before I posted my problem here I tried everything as as outlined in https://wiki.lyrasis.org/display/DSDOC7x/Installing+DSpace#InstallingDSpace-FrontendInstallation 
It is not working without pm2. 

/dspace-ui-deploy$ node ./dist/server/main.js

Building production app config

Overriding app config with /dspace-ui-deploy/config/config.yml

Overriding app config with /dspace-ui-deploy/config/config.prod.yml

Angular config.json file generated correctly at /dspace-ui-deploy/dist/browser/assets/config.json 


Environment extended with app config


dspace-angular

Version: 7.5.0

Environment: Production


[HPM] Proxy created: /  -> https://<nameOfMyServer>/server/sitemaps

[08:20:25 GMT+0200 (Mitteleuropäische Sommerzeit)] Listening at http://localhost:4000/


If I do:

--2023-05-23 08:33:09--  http://localhost:4000/

Auflösen des Hostnamens localhost (localhost) … ::1, 127.0.0.1

Verbindungsaufbau zu localhost (localhost)|::1|:4000 … fehlgeschlagen: Verbindungsaufbau abgelehnt.

Verbindungsaufbau zu localhost (localhost)|127.0.0.1|:4000 … verbunden.

HTTP-Anforderung gesendet, auf Antwort wird gewartet … 


Then nothing happens. And I mean nothing. I can see the connection in netstat
tcp        0      0 localhost:4000          localhost:46794         VERBUNDEN   dspace     784425     44998/node

And I don't get an answer where I started wget. And I am patient. After more then 15 minutes I get 

GET / - - ms - -

on the console where I started node
an other 15 minutes:

Lesefehler (Die Wartezeit für die Verbindung ist abgelaufen) beim Vorspann (header).

Erneuter Versuch.


--2023-05-23 08:48:10--  (Versuch: 2)  http://localhost:4000/

Verbindungsaufbau zu localhost (localhost)|127.0.0.1|:4000 … verbunden.

HTTP-Anforderung gesendet, auf Antwort wird gewartet …


It starts a third try, before it gives up. 
And no clue what is wrong. I did the test:

dspace-angular$ yarn test:rest

yarn run v1.22.19

$ ts-node --project ./tsconfig.ts-node.json scripts/test-rest.ts

Building production app config

Overriding app config with /home/dspace/dspace-angular/config/config.yml

Overriding app config with /home/dspace/dspace-angular/config/config.prod.yml

...Testing connection to REST API at https://<nameOfMyServer>/server/api...


RESPONSE: 200 200 


Checking JSON returned for validity...

"dspaceVersion" = DSpace 7.5

"dspaceUI" = https://<nameOfMyAngularServer>

"dspaceServer" = https://<nameOfMyServer>/server

"dspaceServer" property matches UI's "rest" config? true

Does "/api" endpoint have HAL links ("_links" section)? true

Done in 5.38s.


In the Apache Config I included 
ProxyPass / http://localhost:4000/
ProxyPassReverse / http://localhost:4000/

I can't do more then doing exactly what is written in the installation  instructions. So what is wrong?

Kind Regards 
Christiane

Mark H. Wood

unread,
May 23, 2023, 11:11:48 AM5/23/23
to dspac...@googlegroups.com
On Tue, May 23, 2023 at 12:06:07AM -0700, Christiane Baier wrote:
> Before I posted my problem here I tried everything as as outlined in
> https://wiki.lyrasis.org/display/DSDOC7x/Installing+DSpace#InstallingDSpace-FrontendInstallation
>
> It is not working without pm2.
>
> */dspace-ui-deploy*$ node ./dist/server/main.js
>
> Building *production* app config
>
> Overriding app config with /dspace-ui-deploy/config/config.yml
>
> Overriding app config with /dspace-ui-deploy/config/config.prod.yml
>
> Angular *config.json* file generated correctly at
> */dspace-ui-deploy/dist/browser/assets/config.json*
The problem may be due to the single-threaded nature of Node in
combination with Apache HTTPD default proxy behavior. I think that
HTTPD will try to open multiple connections to Node and keep them
open, but Node serves them serially. So HTTPD has several connections
open and tries to use them, but Node is waiting for the first
connection to be torn down before serving another one.

This is a proxy configuration that I have for my development
environment, which runs an Apache proxy in front of Node without PM2:

<Location "/">
SetEnv proxy-nokeepalive 1
SetEnv proxy-initial-not-pooled 1
</Location>
ProxyPassMatch "^/(scholarworks7.5/ws)$" \
ws://localhost:4075/scholarworks7.5/$1
ProxyPass "/scholarworks7.5/" \
"http://localhost:4075/scholarworks7.5/" \
disablereuse=On \
max=1
ProxyPassReverse "/scholarworks7.5/" \
"http://localhost:4075/scholarworks7.5/"

Executive summary: open one connection to Node at a time and tear it
down after use.

I have Node running on port 4075 because I sometimes have multiple
versions running concurrently and need to spread them across different
ports.

I may not need *all* of those non-default settings, but for now I
don't want to experiment further with a working configuration.

--
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu
signature.asc

Tim Donohue

unread,
May 24, 2023, 2:57:47 PM5/24/23
to Christiane Baier, DSpace Technical Support
Hi Christiane,

Are you certain that localhost is resolving to 127.0.0.1?  Maybe you need to check your Hosts file?

Based on what you've shared, it sounds like your REST API is configured properly (yarn rest:test succeeds).  It also sounds like the UI is starting up on localhost:4000 without reporting any errors.  

But, it's really odd that wget gives no response at all for a long time.  It's almost like it cannot "find" localhost at all, and then you hit a connection timeout.

I've never seen this issue before myself... but it almost sounds like you have a lower-level issue with resolving the connection.  It might not be an issue with DSpace at all.  If you are seeing no errors and no logs, maybe DSpace is "working" but your network connections are not?

You also could try to see if you could get it running at 127.0.0.1:4000 instead of localhost:4000. 

Those are my best ideas right now, but maybe someone else on this list would have other brainstorms to share. 

Tim

From: dspac...@googlegroups.com <dspac...@googlegroups.com> on behalf of Christiane Baier <c...@leibniz-psychology.org>
Sent: Tuesday, May 23, 2023 2:06 AM
To: DSpace Technical Support <dspac...@googlegroups.com>
Subject: [dspace-tech] Re: dspace-7.5. angular-ui gives no response
 
--
All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
---
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/a887b33e-f50c-408b-bcea-6c46fd5b6943n%40googlegroups.com.

Christiane Baier

unread,
May 25, 2023, 2:09:39 AM5/25/23
to DSpace Technical Support
To whom it may consern,

For all how run into similar problems, try to start the angular-ui in development mode with:
  NODE_ENV=development
In the dspace-angular directory (the git repository) create a  config/config.development.yml. It can be identical to your config/config.prod.yml.
Then start the application with
  yarn start:dev
This opens up an angular cli on the port you specified in the config.development.yml
It makes a whole lot of difference, if it is not node which runs the application, but ng.
I  didn't change anything else in my settings, but now I was able to analyse the network traffic in the web development tools in my browser. This told me, my configuration settings where right, the proxy settings where okay. Still got no content on the website, but this was due to a 500 server error for one ot the requests at the rest api from the dspace backend. This single error cause the whole application to fail, so only a white webpage was displayed. In production mode, with node running the application, there is only a timeout and nothing else.  Finally I was able to see, what caused my problem. I fixed the backend and now it works.

I still have the
1 rules skipped due to selector errors:
  .custom-file-input:lang(en)~.custom-file-label -> unmatched pseudo-class :lang
in the logs. But as long as I have a website, this doesn't concern me.

I don't know how to mark a thread as solved, but I solved it.

Kind Regars Christiane
Reply all
Reply to author
Forward
0 new messages