Sveltekit Endpoints - A certain NPM package not working


I just started using Cloudflare pages yesterday. Scenario is that I’m using Sveltekit. And, I’ve implemented some APIs using the Sveltekit’s “endpoints”. I am using this package “link-preview-js” which is perfectly working fine locally. But when deployed it is not working as normal. Here is the main snippet:

// ...
await getLinkPreview(link, {
		// headers: { 'user-agent': 'googlebot' },
		timeout: 7000,
		.then((_data) => {
			data = _data;
		.catch((e) => {
			rawError = e;
			errCode = 400;
// ...

The catch section does not even return any errors. It’s empty. I looked at link-preview-js repo and tried look for an answer but cannot find any. I even commented out the “headers” line to check if maybe it’s because of the user-agent thing. Still, not working.

And it’s hard to replicate the scenario, since I cannot even see any error logs in Cloudflare pages.

Hope anyone can help. Thank you.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.