DSPACE7 no _links section found in production mode

2,400 views
Skip to first unread message

Jan Broulím

unread,
Oct 4, 2021, 11:23:09 AM10/4/21
to DSpace Technical Support
Hello,

we are installing DSpace7 and unfortunately have problems, which we are not able to explain or even resolve.

Environment file and apache configuration is attached below.

When running "yarn start:dev", it seems to be working, but when running "yarn start" (environment.prod.ts and environment.dev.ts are the same), we always get "no _links section found..." error.

Could you please help us to resolve the problem? What might be the difference, which can cause this problem?

You can even check - "No _links section found at https://sulis53.zcu.cz/server/api", but this link is normally accessible.
The testing instance runs here: https://sulis53.zcu.cz:

Thank you

With regards

Jan


-------------------------------
environment.*.ts:

export const environment = {
  ui: {
      ssl: false,
      host: 'localhost',
      port: 4000,
      nameSpace: '/'
  },
  rest: {
      ssl: true,
      host: 'sulis53.zcu.cz',
      port: 443,
      nameSpace: '/server'
  }
};


apache:
<VirtualHost _default_:443>
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/sulis53.zcu.cz/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/sulis53.zcu.cz/privkey.pem

    ProxyPass /server http://localhost:8080/server
    ProxyPassReverse /server http://localhost:8080/server

    RequestHeader set X-Forwarded-Proto https

    ProxyPass / http://localhost:4000/
    ProxyPassReverse / http://localhost:4000/

</VirtualHost>

Tim Donohue

unread,
Oct 4, 2021, 11:32:04 AM10/4/21
to DSpace Technical Support
Hi Jan,

We have a guide for that error here: https://wiki.lyrasis.org/display/DSDOC7x/Installing+DSpace#InstallingDSpace-%22No_linkssectionfoundat...%22errorfromUserInterface

That said, your REST API at https://sulis53.zcu.cz/server/ "looks correct" to me, and you can see that it has a "_links" section in the response.

Therefore, I highly suspect something is wrong with your environment.prod.ts.  Are you SURE it's identical  to environment.dev.ts?  Maybe there's a stray comma or odd space or something that is causing issues when the configuration is read by `yarn start`?   When `yarn start` runs, does it say it's using environment.prod.ts, or does it have a message like "No specific environment file found..."  (if it's the latter, that means it's having issues reading your environment.prod.ts)

It's not immediately obvious to me what the problem is...which is why I immediately suspect it might be an invalid config file or similar.

If you are able to figure out the problem, please do let us know. That way we can also update our guide about other issues that might cause this "No _links section found" error.

Tim

Jan Broulím

unread,
Oct 4, 2021, 1:08:06 PM10/4/21
to DSpace Technical Support
Hi Tim,

the files are identical (I also tried a copy of environment.dev.ts to environment.prod.ts), which did not help.


Installed on Debian.

Jan

Jan Broulím

unread,
Oct 8, 2021, 4:03:54 AM10/8/21
to DSpace Technical Support
Any suggestions what to test or what may help? Why does dev mode work?
Thanks

Joel R

unread,
Oct 8, 2021, 7:43:05 AM10/8/21
to DSpace Technical Support
Jan and Tim,

I'm going to offer some extra information that might help future people. I was (am) testing this on a development server with self-signed TLS certificates and that was also causing this error to occur. Since  am on a development server, I switched everything to SSL=false, and HTTP instead of HTTPS and that mostly solved the problems I was having. I will pursue the problem later, but I may need to add my organization's internal Root CA Certificate to my development server and continue testing.

Of course I had to update all of my settings to match (local.cfg, environment.dev.ts, etc)

I don't think a LetsEncrypt Cert would cause this problem, but you never know.

--Joel Richard
Smithsonian Libraries and Archives

Jan Broulím

unread,
Oct 11, 2021, 5:15:08 AM10/11/21
to DSpace Technical Support
Dear Joel,
I tried different certification authority, but it did not help. DSpace still works only in dev mode.
But somehow it can be connected - when I was testing it on 2 machines without SSL, it was working properly.
Thanks
Jan

Jan Broulím

unread,
Oct 11, 2021, 5:19:05 AM10/11/21
to DSpace Technical Support
To Tim: perhaps I can let you enter on our virtual machine if you agree
Jan

Mohammed Al-Shammaa

unread,
Oct 11, 2021, 5:43:55 AM10/11/21
to DSpace Technical Support
Hi,
I have installed DSpace 7 successfully, and it was working fine, however, suddenly it is giving the "No _links section found" error. I tried to "yarn start" and it was run without any errors:

Building production environment
Angular environment.ts file generated correctly at ./src/environments/environment.ts

but the problem still exists.

https://dspace.uobaghdad.edu.iq/

Any help to solve this issue is really appreciated.

Jan Broulím

unread,
Oct 11, 2021, 6:06:58 AM10/11/21
to DSpace Technical Support
Hi Mohammed,
you have exactly the same problem.
Jan

Tim Donohue

unread,
Oct 12, 2021, 12:45:38 PM10/12/21
to DSpace Technical Support
This issue is puzzling to me, as it sounds like it should work.

It makes me wonder if there's a possible SSL Certificate "trust" issue....where the frontend (running on Node.js) is not *trusting* the SSL Certificate that your backend is returning.  We *have* seen this before, but in the past it was always with a self-signed SSL Cert.  We have a couple of general notes on a workaround here: https://wiki.lyrasis.org/display/DSDOC7x/Installing+DSpace#InstallingDSpace-UsingaSelf-SignedSSLCertificatecausestheFrontendtonotbeabletoaccesstheBackend

However, I admit, I'm not 100% sure if this is the issue.

As a sidenote, per Mohammed's site, I've tried updating my local copy of Angular UI (running the latest code) by just updating one line of my "environment.common.ts" file to say "host: 'dspace.uobaghdad.edu.iq'".  I've then run "yarn start", and my UI comes up on http://localhost:4000/ displaying the public content available at https://dspace.uobaghdad.edu.iq/server/.   So, I cannot even reproduce this "no _links section" error if I run in production mode locally.

I'm a bit confused what could be going on, but it seems like it might be an SSL cert trust issue or it might be a configuration error.  Have you also double checked you are running a supported version of Node.js and Yarn? https://wiki.lyrasis.org/display/DSDOC7x/Installing+DSpace#InstallingDSpace-InstallingtheFrontend(UserInterface) 

Tim

Joel R

unread,
Oct 12, 2021, 1:43:15 PM10/12/21
to DSpace Technical Support
I can't say for sure what's going on, but I do recall there are cases where Java uses it's own Root CA Certificate store, separate from the OS. And that (while we aren't using it) PHP sometimes benefits from an explicit path... sometimes. What I mean to say is that not all CA stores are created equally. And when those things are not all aligned properly, we get a SSL trust error. I thought I saw a log file somewhere that indicated as such, before I turned off all SSL.

Since we know that it works with SSL turned off across the board, then turning it on means that's where the error lies. Find all the logs you can, especially [dspace]/logs/* and see what is happening there. Make sure the log levels are set correctly in log4j2.xml, too.

I will be pursuing this in the coming days and I will be using self-signed certificates with a local Root CA certificate for our internal network. Right now, I'm working on debugging something else. :)

--Joel

Mohammed Al-Shammaa

unread,
Oct 12, 2021, 3:31:34 PM10/12/21
to DSpace Technical Support
Thank you very much Tim. The issue was indeed with the ssl cert. Apparently, all let's encrypt root certificates has expired on 30th September. Creating a new certificate solved the issue. 

NTech

unread,
Oct 19, 2021, 12:20:49 PM10/19/21
to DSpace Technical Support
I am also facing the exact same issue with similar configuration. 
Both backend and frontend installed in a windows server. 
Using Apache to proxy and SSL. 
Generated a new SSL certificate and this shows secure while trying to access UI/ Backend from browser.  Also additionally added an environment variable NODE_EXTRA_CA_CERTS pointing to the PEM file 
No clue why this fails with SSL certificate . 
Everything worked Ok without SSL though.

Please help.

Tim Donohue

unread,
Oct 19, 2021, 12:41:05 PM10/19/21
to NTech, DSpace Technical Support
Hi all,

Since it sounds like several folks have hit on this thread, I want to stress that this "no _links section found in production mode" error can be caused by a variety of issues​​.  Unfortunately, this error simply means that your Frontend cannot communicate with your Backend.

Therefore, it may appear in any of these sorts of scenarios:
  • Configuration issues in the frontend or backend.  Especially check "rest" configuration of frontend & the "dspace.ui.url" configuration of the backend.
  • SSL certificate expiration or trust issues.  More specifically, if the frontend (Node.js) doesn't trust your backend's SSL certificate, this may occur. See this StackOverflow on trusting certs in Node.js: https://stackoverflow.com/questions/29283040/how-to-add-custom-certificate-authority-ca-to-nodejs  (This especially can occur if you have a self-signed cert...but is seems some folks have also seen this with Lets Encrypt signed certs)
  • There is something else blocking access of the frontend to the backend...could be a proxy issue, a firewall issue, or even something else blocking the usual access ports (80 for HTTP or 443 for HTTPS).  You should verify the backend can be accessed from the server running your frontend. Also verify the backend is accessible to the client machine​ you are testing from (i.e. from your browser).  Generally, your backend should be publicly accessible on the web, unless all your users are guaranteed to be behind a VPN or similar.
  • (Other undiscovered scenarios may also exist...these are just the most common)
There's unfortunately not a single solution that can solve this problem 100% of the time.  I wish there was, but this error is a generic error which provides us with no information about what might be the root cause. 

To those of you seeing this error, I think we'd need more information on this list about your setup to help provide better advice.  Also take a closer look at other "common installation issues" to verify that none of them apply to your site: https://wiki.lyrasis.org/display/DSDOC7x/Installing+DSpace#InstallingDSpace-CommonInstallationIssues

Glad to try and offer more advice to folks, but we'd need more information about your setup on this list before we can help narrow down the problem. 

Tim


From: dspac...@googlegroups.com <dspac...@googlegroups.com> on behalf of NTech <njcon...@gmail.com>
Sent: Tuesday, October 19, 2021 11:20 AM
To: DSpace Technical Support <dspac...@googlegroups.com>
Subject: [dspace-tech] Re: DSPACE7 no _links section found in production mode
 
--
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/b5058605-34c0-4d68-9072-1ca4d76bf710n%40googlegroups.com.

NTech

unread,
Oct 19, 2021, 1:14:42 PM10/19/21
to DSpace Technical Support
Hi Tim, 

I am just wondering why Front end is unable to hit the backend with SSL . Let me give you detailed info and hope this will help you assist me to solve the issue. 

I am accessing app using VPN from Edge browser. 

Apache Proxy Configuration is as below 

<VirtualHost _default_:443>
     SSLEngine on
     SSLCertificateFile "C:/Certificate/dspace.crt"  
     SSLCertificateKeyFile "C:/Certificate/dspace-decrypted.key"
  
    ProxyPass /server http://localhost:8080/server
    ProxyPassReverse /server http://localhost:8080/server
    RequestHeader set X-Forwarded-Proto https

    ProxyPass / http://localhost:8983/
    ProxyPassReverse / http://localhost:8983/
</VirtualHost>

Local.cfg File 


Environment.prod.ts

export const environment = {
    ui: {
    ssl: false,
    host: 'localhost',
    port: 8983,
    // NOTE: Space is capitalized because 'namespace' is a reserved string in TypeScript
    nameSpace: '/'
},

rest: {
  ssl: true,
  port: 443,
  // NOTE: Space is capitalized because 'namespace' is a reserved string in TypeScript
  nameSpace: '/server'
}
};

Error in Console Developer Tools

hal-endpoint.service.ts:42 
(anonymous) @ hal-endpoint.service.ts:42

Attached the snapshots of browser for front end ,backend, certificate as well as console error. 

Unable to identify the exact problem or what to be troubleshooted further . Please assist.

OneDrive_2_10-19-2021.zip

NTech

unread,
Oct 20, 2021, 9:38:46 AM10/20/21
to DSpace Technical Support
can somebody help me . Will appreciate your support here. 
If possible share me steps i can take to narrow down further. 
From client browser i can access the server api as well as UI on hitting the respective URL's. 
For some reason, no links section displayed when running the app with production mode.
 All suggestions followed from common installation issues and fixes highlighted in dpsace site . All software / setup versions as per recommendation of Dspace 7 docs. 
NODE_EXTRA_CA_CERTS is also set. 
Certificate issued by globalsign . Root certificate expiry is also correct. 
 Anything i can do to get some logs information in Front end to understand what causes to fail ? 

Tim Donohue

unread,
Oct 25, 2021, 1:29:16 PM10/25/21
to NTech, DSpace Technical Support, Tim Donohue
All,

As of today, on the "main" branch of the UI, you can also find a brand new "yarn config:check:rest" script which can test the connection between Node.js and your backend REST API to provide you more information on any connection errors or problems.  

We are hoping this simple script will allow us to more easily debug this "no _links section found" error, as this new script should provide use with Node.js level HTTP connection messages.

This script will also be released in 7.1 (due next week).  In the meantime though, if you want to use it immediately, you could upgrade to the latest "main" branch of the frontend & backend.  Or, you could manually download the script via this PR: https://github.com/DSpace/dspace-angular/pull/1368


Tim


From: 'Tim Donohue' via DSpace Technical Support <dspac...@googlegroups.com>
Sent: Tuesday, October 19, 2021 11:40 AM
To: NTech <njcon...@gmail.com>; DSpace Technical Support <dspac...@googlegroups.com>
Subject: Re: [dspace-tech] Re: DSPACE7 no _links section found in production mode
 
Reply all
Reply to author
Forward
0 new messages