Hello Appwriters,
i'm trying to access a file from a URL https://cloud.appwrite.io/v1/storage/buckets/xxxxx/files/66fcf26e003a344043e8/view?project=xxxxx&project=xxxxxx&mode=admin and its a JSON file
TypeScript
This file is being treated as an ES module because it has a '.js' file extension and '/usr/local/server/src/function/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///usr/local/server/src/function/src/main.js:4:22
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
at async execute (/usr/local/server/src/server.js:178:24)
at async action (/usr/local/server/src/server.js:225:7)
at async /usr/local/server/src/server.js:14:5
Please what i'm i doing wrong?
TL;DR
Issue: Unable to reference hosted files in cloud function due to ES module scope error.
Solution: Update `package.json` to include `"type": "module"`.does your package.json have "type": "module"?
yes, it does
Recommended threads
- Server Down
Appwrite services are down. When will they start working again?
- My cloud functions failing 3 days ago (P...
Hi, My cloud function using python has been failing for 3 days, I didn't push any new deployments... Its something to do with it not recognising the entrypoi...
- Scheduled works locking the entire Maria...
I have a scheduled function and apparently that or something is locking the entire MariaDB database and Appwrite is giving MariaDB errors. This error persists e...