# 500 Internal Server Error on POST https://api.pdfjs.express/xfdf/merge (Aug 9, 2024 | macOS)

**URL:** <https://pdfjs.community/t/500-internal-server-error-on-post-https-api-pdfjs-express-xfdf-merge-aug-9-2024-macos/3394>\
**Category:** Bug Reports\
**Tags:** pdfjs-express\
**Created:** [August 9, 2024, 8:02pm UTC](https://pdfjs.community/t/500-internal-server-error-on-post-https-api-pdfjs-express-xfdf-merge-aug-9-2024-macos/3394 "2024-08-09T20:02:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![devops1](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@devops1](https://pdfjs.community/u/devops1)\
**Post date:** [August 9, 2024, 8:02pm UTC](https://pdfjs.community/t/500-internal-server-error-on-post-https-api-pdfjs-express-xfdf-merge-aug-9-2024-macos/3394/1 "2024-08-09T20:02:24Z")

</div>

**Description:**

We are experiencing a 500 Internal Server Error when making a POST request to the following endpoint as of Friday, August 9th. This is similar to the error we encountered previously.

**Endpoint:** [https://api.pdfjs.express/xfdf/merge](https://api.pdfjs.express/xfdf/merge)  
**HTTP Method:** POST

**Additional details:**

- The error started occurring recently (August 9, 2024)
- This endpoint was previously working as expected
- No changes were made to our implementation before the error started occurring

Steps to reproduce:

1. Send a POST request to [https://api.pdfjs.express/xfdf/merge](https://api.pdfjs.express/xfdf/merge)
2. Observe the 500 Internal Server Error response

Expected behavior:  
The API should process the request and return a successful response.

Actual behavior:  
The API returns a 500 Internal Server Error.

Impact:  
This issue is preventing us from merging XFDF data, which is critical for our application’s functionality.

Screenshots:

 ![Screenshot 2024-08-09 at 12.58.45](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/e/e5aeaa06f0dbbb8db760edb5a579180cf57a83ad.png)  
 ![Screenshot 2024-08-09 at 12.59.01](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/3/35e6d9743db470c76c920925ad8a28eece1b096c.png)  
 ![Screenshot 2024-08-09 at 12.59.06](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/2/2e21de8dd164a9dbefe5f4bd5791aca2a2a0e347.png)

Link to the previously reported issue (Occurred on July 11):

> [@500 Internal Server Error on POST https://api.pdfjs.express/xfdf/merge](https://pdfjs.community/t/500-internal-server-error-on-post-https-api-pdfjs-express-xfdf-merge/3352):
>
> Description: We are encountering a 500 Internal Server Error when making a POST request to the following endpoint: Endpoint: [https://api.pdfjs.express/xfdf/merge](https://api.pdfjs.express/xfdf/merge) HTTP Method: POST Additional details: The error started occurring recently (July 11, 2024 9.43 PM UTC) This endpoint was previously working as expected No changes were made to our implementation before the error started occurring Steps to reproduce: Send a POST request to [https://api.pdfjs.express/xfdf/merge](https://api.pdfjs.express/xfdf/merge) Observe the 500 Int…

NOTE:  
This issue exists on MacBook (macOS) devices, but the merge API appears to function correctly on Windows.

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [August 9, 2024, 9:08pm UTC](https://pdfjs.community/t/500-internal-server-error-on-post-https-api-pdfjs-express-xfdf-merge-aug-9-2024-macos/3394/3 "2024-08-09T21:08:48Z")

</div>

Hi there,

It looks like you are getting error code 27, which indicates that a client side key was provided for a server side request:

> **[PDF.js Express API Errors | Documentation](https://pdfjs.express/documentation/utils/errors#errors)**

Could you please verify if the key was passed correctly on your end?

Best regards,  
Kevin Kim

---

<div class="post-metadata">

**Author:** ![devops1](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@devops1](https://pdfjs.community/u/devops1)\
**Post date:** [August 9, 2024, 9:38pm UTC](https://pdfjs.community/t/500-internal-server-error-on-post-https-api-pdfjs-express-xfdf-merge-aug-9-2024-macos/3394/4 "2024-08-09T21:38:08Z")

</div>

Hi @kkim, we can confirm that the provided keys are valid. Additionally, the same request with the same merge API is working fine on Windows.

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [August 12, 2024, 3:08pm UTC](https://pdfjs.community/t/500-internal-server-error-on-post-https-api-pdfjs-express-xfdf-merge-aug-9-2024-macos/3394/5 "2024-08-12T15:08:41Z")

</div>

Hi there,

I am able to use the merge API using MacOS with the following snippet, could you please try it out and see if it works for you?

```javascript
                const utils = new ExpressUtils();
                const xfdf = await annotationManager.exportAnnotations({ links: false, widgets: false });
                console.log(xfdf);
                const fileData = await documentViewer.getDocument().getFileData({});
           
                const resp = await utils
                    .setFile(fileData)
                    .setXFDF(xfdf)
                    .merge();
                const mergedBlob = await resp.getBlob();
                saveAs(mergedBlob, 'myfile.pdf')
                console.log(mergedBlob);

```

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/e/e5b2e749ef72d58399b992340ed6b7acc76327ef.jpeg)

Best regards,  
Kevin Kim
