External dependency: 'grammy' module => failed to execute source

Hello,
I try to use ‘grammy’ external dependency in atlas function to create a Telegram bot.
I got the following error when calling the external module

const grammy_1 = require("grammy");

=> ERROR

> error: 
failed to execute source for 'node_modules/grammy/out/mod.js': FunctionError: failed to execute source for 'node_modules/grammy/out/bot.js': FunctionError: failed to execute source for 'node_modules/grammy/out/core/api.js': FunctionError: failed to execute source for 'node_modules/grammy/out/core/client.js': FunctionError: failed to execute source for 'node_modules/grammy/out/core/payload.js': ReferenceError: 'TextEncoder' is not defined
	at node_modules/grammy/out/core/payload.js:177:15(134)

	at require (native)
	at node_modules/grammy/out/core/client.js:32:28(60)

	at require (native)
	at node_modules/grammy/out/core/api.js:40:27(52)

	at require (native)
	at node_modules/grammy/out/bot.js:63:24(92)

	at require (native)
	at node_modules/grammy/out/mod.js:41:24(55)

Has someone already tried & succeded to use grammy in mongodb-atlas functions ?
Or does someone have an idea why I am having this error ?
Regards,
Enguerrand