SSR 500 Error on Direct Routes

138 views
Skip to first unread message

Anand chavan

unread,
Jul 14, 2025, 5:33:09 AM7/14/25
to DSpace Technical Support
Dear DSpace Team,

We’re facing a persistent issue with SSR in our DSpace 8.1 Angular UI setup at https://ir.daiict.ac.in.

Directly accessing or reloding pages like /community-list or /search results in a 500 Internal Server Error.

pm2 shows following error logs:

/root/.pm2/logs/dspace-ui-error-1.log last 15 lines:
1|dspace-u |     at /home/dspace/dspace-angular-dspace-8.1/dist/server/main.js:1:3736933
1|dspace-u |     at _ZoneDelegate.invokeTask (/home/dspace/dspace-angular-dspace-8.1/dist/server/main.js:1:3726815)
1|dspace-u |     at ZoneImpl2.runTask (/home/dspace/dspace-angular-dspace-8.1/dist/server/main.js:1:3719213)
1|dspace-u | Warning [ERR_HTTP_HEADERS_SENT]: Tried to set headers after they were sent to the client
1|dspace-u | Error: Cannot set headers after they are sent to the client
1|dspace-u |     at new NodeError (node:internal/errors:405:5)
1|dspace-u |     at ServerResponse.setHeader (node:_http_outgoing:648:11)
1|dspace-u |     at ServerResponse.res.set.res.header (/home/dspace/dspace-angular-dspace-8.1/dist/server/main.js:1:2782438)
1|dspace-u |     at ServerResponse.res.send (/home/dspace/dspace-angular-dspace-8.1/dist/server/main.js:1:2776806)
1|dspace-u |     at /home/dspace/dspace-angular-dspace-8.1/dist/server/main.js:1:7636921
1|dspace-u |     at _ZoneDelegate.invoke (/home/dspace/dspace-angular-dspace-8.1/dist/server/main.js:1:3725973)
1|dspace-u |     at ZoneImpl2.run (/home/dspace/dspace-angular-dspace-8.1/dist/server/main.js:1:3718144)
1|dspace-u |     at /home/dspace/dspace-angular-dspace-8.1/dist/server/main.js:1:3736933
1|dspace-u |     at _ZoneDelegate.invokeTask (/home/dspace/dspace-angular-dspace-8.1/dist/server/main.js:1:3726815)
1|dspace-u |     at ZoneImpl2.runTask (/home/dspace/dspace-angular-dspace-8.1/dist/server/main.js:1:3719213)

Please help us in this regard,

Best,
Anand

DSpace Technical Support

unread,
Jul 16, 2025, 12:31:30 PM7/16/25
to DSpace Technical Support
Hi Anand,

The logs you shared seem to be from the frontend, but the 500 Internal Server Error is usually thrown by the *backend*.  I'd recommend looking for more details on the 500 error in your backend logs.  See our Troubleshooting Guide for details: 
https://wiki.lyrasis.org/display/DSPACE/Troubleshoot+an+error#Troubleshootanerror-DSpace7.x(orabove)

The issue you shared on the frontend may be unrelated.  It sounds like this issue https://github.com/DSpace/dspace-angular/issues/2315 , but it's usually harmless. There is a possible workaround in the comments on that ticket though.

Tim

Anand chavan

unread,
Jul 18, 2025, 1:37:12 AM7/18/25
to DSpace Technical Support
Hi Tim,

Thank you for your reply,

As you have said I have checked the dspace backend logs and i have found this error:

ERROR unknown 992914b9-aa89-4152-a3b0-458411a51f44 org.dspace.app.rest.exception.DSpaceApiExceptionControllerAdvice @ An exception has occurred (status:500) java.lang.IllegalStateException: The requested browse doesn't provide direct access to items you must specify a filter at org.dspace.app.rest.repository.BrowseItemLinkRepository.listBrowseItems(BrowseItemLinkRepository.java:82) at jdk.internal.reflect.GeneratedMethodAccessor518.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) ... (and the rest of the stack trace)  

How do i fix this error or do i have to rebuild the package and install it again or go to the next DSpace version whichis 8.2?
Anand

DSpace Technical Support

unread,
Jul 18, 2025, 10:05:32 AM7/18/25
to DSpace Technical Support
Hi Anand,

Could you please provide the entire Stacktrace, along with the 5-10 log lines just before this?  The stacktrace you've provided only gives partial information.  It seems to be saying your browse indexes are invalid, but it doesn't give a reason why. 

It'd also be important to understand if this occurs on *every* browse/search page, or just some pages?   If it's every page, it might be a problem with your Solr index or similar.  So, you should try to run "./dspace index-discovery -b" from the commandline (to attempt to rebuild your indexes) and see if that succeeds or fails.  If it fails, it might give more information as to why Solr isn't working.

You should also look for any additional "ERROR" messages in your logs.  Sometimes there are earlier "ERROR" messages that provide more details as to the problem, and they are the cause of the later ERROR messages.

Tim

Anand chavan

unread,
Jul 21, 2025, 2:16:42 AM7/21/25
to DSpace Technical Support

Hello Tim,

I have tried running ./dspace index-discovery -b multiple times, and the script is not failing.

However, I am encountering 500 errors on the following pages:

  • /community-lists

  • /profile

  • /search?spc.page=1

  • /statistics

  • /browse/*

  • /register

Item pages work fine when accessed directly or reloaded. For example:
/items/b24ec171-5668-4be4-8945-aa43e972c095

As you requested, I have generated and attached the error logs for your reference.

I also noticed that when a 500 error occurs, the browser console shows the environment switching to Development.
Additionally, even though I have updated the domain from drsr.daiict.ac.in to ir.daiict.ac.in in config.prod.yml, local.cfg, and dspace.cfg, apache-site.conf the console still shows the following error:
Failed to load resource: net::ERR_NAME_NOT_RESOLVED drsr.daiict.ac.in/server/api:1

I'm not sure if I’m missing something or if there's a configuration issue.

Best regards,
Anand

dspace.log

DSpace Technical Support

unread,
Jul 21, 2025, 12:12:40 PM7/21/25
to DSpace Technical Support
Hi Anand,

Nearly all of the pages you listed as failing are highly reliant on Solr.  So, you may want to verify that Solr is accessible and working properly.  You also could look to see if the "Health" page in the DSpace Admin sidebar shows any errors (Login as an Admin, and go to the "Health" option in that sidebar menu)

Unfortunately, the logs you shared are not useful beyond verifying that this error is occurring frequently.  You've accidentally trimmed all the error messages of useful information (especially if any of the errors have a "Caused by" clause in the stacktrace, as that can often give a better hint as to the error cause).  It's important to give the full error stacktrace (even if it's massively long)

I'm actually surprised that the "./dspace index-discovery -b" command isn't throwing errors in your log file.  Have you tried watching the logged output while running that command?   It should log output to your "dspace.log" file -- either it will show items getting reindexed in that log, or it will throw errors in that log.

There are other ways to also look for errors that we've documented in our Troubleshooting Guide.  If the errors are not visible in the logs by default, then one of these may also help: https://wiki.lyrasis.org/display/DSPACE/Troubleshoot+an+error#Troubleshootanerror-DSpace7.x(orabove)

Essentially, it seems like you need to dig a bit more through the logs to look for patterns or specific "caused by" error sections.  You also may want to look at your Tomcat logs, Solr logs and Database logs to see if they provide more clues.  There's something severe that has broken (or was never working properly), but it's unclear to me still where the issue is.

Tim

Anand chavan

unread,
Jul 22, 2025, 2:27:27 AM7/22/25
to DSpace Technical Support
Hi Tim,

Good news, I've solved the 500 error, and thank you for your help!

The root cause was entirely on the UI side. The browser console kept showing connection errors for our old domain (drsr.daiict.ac.in).

I discovered a src/assets/config.json file that still contained the old domain. It seems our build process was using this file instead of our config.prod.yml, which is why our first edits had no effect.

After correcting config.json, rebuilding the UI fixed the 500 error. A final tweak in server.ts was also needed to solve an issue with translation keys showing up on reload.

Thanks again :)

Best regards,
Anand
Reply all
Reply to author
Forward
0 new messages