Next.js Discord

Discord Forum

React-pdf error (Promise.withResolvers is not a function) in use client component

Unanswered
Poodle posted this in #help-forum
Open in Discord
Avatar
PoodleOP
I get "TypeError: Promise.withResolvers is not a function" in terminal and in browser http://localhost:3000/dashboard 500 (Internal Server Error) but the document loads as expected. What causes this annoying error message and how can I get rid of it?

Here's my code ( this component is rendered in a use client page as well)

"use client"

import Link from "next/link";
import { Document, Page } from "react-pdf";

const DocumentThumbnail = ({ file, href }: { file: Blob; href: string }) => (
    <Document
        file={file}
        error={null}
        noData={null}
        loading={<div className="absolute inset-0 w-full h-full bg-gray-100" />}
    >
        <Link
            href={href}
            className="absolute inset-0 w-full h-full object-contain react-pdf-thumbnail"
        >
            <Page
                pageNumber={1}
                width={300}
                loading={
                    <div className="absolute inset-0 w-full h-full bg-gray-100" />
                }
                renderAnnotationLayer={false}
                renderTextLayer={false}
            />
        </Link>
    </Document>
);

export default DocumentThumbnail;

0 Replies