DOCXKIT_PREVIEW_FETCH_FAILED: Preview fetch failed
The DOCX URL could not be fetched successfully.
What to do
- Check the HTTP response, network, authentication, and CORS settings.
- Use local DOCX bytes when remote fetching is unavailable.
Problem example
ts
import { createDocx, createDocxPreview } from 'docx-kit'
const container = document.createElement('div')
document.body.append(container)
const preview = createDocxPreview(container)
try {
await preview.render('https://example.com/missing.docx')
} finally { preview.destroy() }Corrected example
ts
import { createDocx, createDocxPreview } from 'docx-kit'
const container = document.createElement('div')
document.body.append(container)
const preview = createDocxPreview(container)
try {
const blob = await createDocx().p('Hello').toBlob()
await preview.render(blob)
} finally { preview.destroy() }Common causes
- A non-success HTTP response, network failure, or blocked cross-origin request.
Diagnostic fields
code:PREVIEW_FETCH_FAILEDdiagnosticCode:DOCXKIT_PREVIEW_FETCH_FAILEDname:DocxKitErrordocs: https://docx-kit.ntnyq.dev/errors/docxkit_preview_fetch_failed/
Example message
text
Failed to fetch DOCX: HTTP 404