500 error only on deployed Svelte/Sapper site - working fine in development


On one of the pages on my site I’ve implemented pagination for the display of info cards (navigate to /vigilance). Somehow this is having an effect on the links from page 2 onwards. The ‘details’ links produce a 500 error with the following message: ‘JSON.parse: unexpected character at line 1 column 1 of the JSON data’

The error doesn’t make sense to me since the links are using the same function that the working links on page 1 use. Also, in development, all links on all pages work perfectly.

I’ve lost a lot of time to this error and can’t think what to try next. Any pointers would be greatly appreciated!

Repo is here: https://github.com/rumack/nlb-sapper

So the problem was that the Sapper export wasn’t including the links in the pagination in its export build. I used a quick hacky fix in the end: I just just placed all the cards in a hidden div so that the links would be registered in the export, and left the paginated links as they were. All working now.

1 Like

Hi, @roro, thanks for following up to share your solution. :+1: