I have been trying for the last 5 days to get a simple function to work. Not even the demo examples work and at this point, I think the issue is with DigitalOcean. I am using a Nodejs function to output a string. I try using import a module and this is the error I get: " Error [ERR_MODULE_NOT_FOUND]: Cannot find package ‘parse-domain’ imported from /tmp/index.mjs". So I try to change it to require and get this error: “ReferenceError: require is not defined in ES module scope, you can use import instead”. I am using “doctl serverless deploy . --remote-build” in the same directory as the project.yml. I added “type”: “module” in the package.json as well. I have the dependencies listed in there as well. I also ran npm install --package-lock-only parse-domain which didn’t work. I have module.exports.main = checkURL (function name) at the end. There is little to no documentation around DO functions and nodejs other than the examples which again doesn’t even work because I get the same error.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.