Trying to use D1 for my project. But getting an error

Hello everyone. I am new to cloudflare stuff and started experimenting with workers.
Im trying to publish a Pastebin like app so I can store pastes in it and share those.

https://gist.github.com/frontlineroleplaysrilanka/7e8e8f39e214f49603f2407693b25caa

Here is the current code of index.js and im trying to utilize the D1 database in it. But when I try to deploy it, an error comes which shows:

X [ERROR] A request to the Cloudflare API (/accounts/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/workers/scripts/paste) failed.

  D1 bindings require module-format workers. [code: 10021]


Any help please ๐Ÿ˜Š ?
Thanks.
Gist
Paste App but using D1. GitHub Gist: instantly share code, notes, and snippets.
Was this page helpful?