"undefined" is not valid JSON error on updating "@syncfusion/ej2-react-pdfviewer"

I updated the @syncfusion/ej2-react-pdfviewer library and dependencies to version 26 alongwith my new syncfusion license key :

  "@syncfusion/ej2-base": "^26.2.10",
   "@syncfusion/ej2-buttons": "^26.2.10",
  "@syncfusion/ej2-dropdowns": "^26.2.13",
   "@syncfusion/ej2-inputs": "^26.2.14",
 "@syncfusion/ej2-lists": "^26.2.14",
@syncfusion/ej2-navigations": "^26.2.12",
@syncfusion/ej2-pdfviewer": "^26.2.14",
@syncfusion/ej2-react-pdfviewer": "^26.2.14",

but on previewing the pdf the error is coming as

SyntaxError: "undefined" is not valid JSON

    at JSON.parse (<anonymous>)

    at FormFields.retreiveFormFieldsData (form-fields.js:639:1)

    at FormFields.formFieldCollections (form-fields.js:568:1)

    at PdfViewerBase.saveFormfieldsData (pdfviewer-base.js:3360:1)

    at PdfViewerBase.requestSuccess (pdfviewer-base.js:2978:1)

    at loadRequestHandler.onSuccess (pdfviewer-base.js:2845:1)

    at AjaxHandler.successHandler (ajax-handler.js:195:1)

    at AjaxHandler.stateChange (ajax-handler.js:173:1)

    at httpRequest.onreadystatechange (ajax-handler.js:68:1)

I have reviewed my service-url, it is working fine. he same code was working fine with my previous version (23.1) Please help me to resolve this issue


4 Replies

SK Sathiyaseelan Kannigaraj Syncfusion Team September 19, 2024 06:58 PM UTC

Hi Amit Kumar,

Thank you for reaching out to us. We believe this issue may have occurred if both the client and server sides were not updated properly. Please ensure that both sides have been updated correctly. Below, we have provided a sample upgraded to the version you mentioned. Kindly verify if the issue persists in the provided sample.

Client Sample


Web Service Sample


Replication Steps
:

  1. Run the Web Service Sample.
  2. Run the Client Sample.


Regards,
Sathiyaseelan K



RD Rahul Dholariya February 11, 2025 08:43 AM UTC

Hello  Sathiyaseelan K,


I'm download your samples and run this Image_8071_1739263291098

this is server's terminal and it is running now and also Image_7228_1739263340822

this is client's terminal it is also working fine But in API Image_6167_1739263379952

throwing this error

So can you please solve this



RD Rahul Dholariya February 11, 2025 08:43 AM UTC

Hello  Sathiyaseelan K,


I'm download your samples and run this Image_8071_1739263291098

this is server's terminal and it is running now and also Image_7228_1739263340822

this is client's terminal it is also working fine But in API Image_6167_1739263379952

throwing this error

So can you please solve this



SK Sathiyaseelan Kannigaraj Syncfusion Team February 12, 2025 02:14 PM UTC

Hi Rahul Dholariya,

Thank you for the update. After reviewing your provided code snippet, we found that the issue occurred because the service URL was not properly included in the client sample. Your sample server was running on the service URL "http://localhost:3001". Please update the client-side configuration with the same service URL and check if you encounter any issues.

Code Snippet
:

serviceUrl="https://localhost:3001/pdfviewer"


Regards,

Sathiyaseelan K


Loader.
Up arrow icon