Skip to content
Back

How to use fetch inside appwrite function

  • 0
  • Cloud
AzizMr
5 Jun, 2025, 01:06

i getting error "Cannot find package 'undici'" I installed undici package and import like this:

import { fetch } from 'undici';

TL;DR
Developers are having trouble using the fetch function inside an Appwrite function. The error "Cannot find package 'undici'" occurs despite installing the undici package and attempting to import fetch from it.
Steven
5 Jun, 2025, 01:13

what's your function build settings?

AzizMr
5 Jun, 2025, 01:28

Node-16.0

Steven
5 Jun, 2025, 01:33

please share a screenshot of the build command section of the settings

AzizMr
5 Jun, 2025, 01:38

even on locally i getting the error

Steven
5 Jun, 2025, 01:39

Can you share your folder structure and your package.json?

AzizMr
5 Jun, 2025, 01:41

{ "name": "azure", "version": "1.0.0", "main": "index.js", "scripts": { "test": "echo Error: no test specified && exit 1" }, "keywords": [], "author": "", "license": "ISC", "description": "", "dependencies": { "undici": "^6.21.3" } }

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more