
i tried to upgrade my old functions, but i now i get this error:
TypeScript
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /usr/code-start/src/main.js
require() of ES modules is not supported.
require() of /usr/code-start/src/main.js from /usr/local/src/server.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename main.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /usr/code-start/package.json.
at new NodeError (node:internal/errors:363:5)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1125:13)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at Module.Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:101:39)
at require (node:internal/modules/cjs/helpers:93:18)
at /usr/local/src/server.js:55:28
at processTicksAndRejections (node:internal/process/task_queues:96:5)
anybody knows what to do?
TL;DR
Developers are encountering an error when trying to upgrade old functions. The issue is related to ES modules and the error message suggests possible solutions such as renaming the file to end in .cjs, changing the requiring code to use import(), or removing "type": "module" from the package.json file.Recommended threads
- Getting Cors Error while running console...
Hi. Can anyone help me resolve this. I was not facing CORS error 15 minutes ago but now for some reason I am getting it and not able to resolve it.
- Issue with functions
Hi, Appwrite (1.7.4 but 1.6.0 too) throw me this error when I upload my functions manually (cant do other way for now) ```[14:59:40] [open-runtimes] Environme...
- Adding new Attributes to Collections doe...
When I add a new attribute to an existing collection, all exisiting documents initialize that attribute to null, even though it has a default value set. I added...
