1

I want to run a serverless function that is actually serverless. Serverless functions platforms like AWS Lambda, Google Cloud Functions, etc... are not actually serverless. A centralized VM owned by Amazon or Google runs the function. I usually make apps that consist of a static site that I host on IPFS connected to a Handshake domain. But I can't do this for certain apps that require dynamic functionality

I have this proof of concept express function. It's a simple anagram finder. It's a simple dumb express.js function but it's just a proof of concept. I would connect this to the backend of a static site.

var express = require('express');
var router = express.Router();

router.post('/', function findAnagramsInArray(req, res) {
  var words = JSON.parse(JSON.stringify(req.body));
  let result = {}

  for (const word of words) {
    const sorted = word.split("").sort().join("");

    if (sorted in result) {
      result[sorted].push(word);
    } else {
      result[sorted] = [word];
    }
  }

  res.send(result);
});

module.exports = router;  

Could this be run in a decentralized trusted compute environment? I've tried Akash but this doesn't work because it's a deal id based service. The URL for the function changes when you renew the deal. This won't work with an IPFS static site because you have to change the connection string for the function, this changes the CID which bricks the website connected to the Handshake domain.

I tried Thirdweb and Moralis and these work but they're actually still centralized in the sense that they still run on privately owned servers like with Amazon Lambda functions. No shade to Thirdweb and Moralis. I actually love these providers it's just not what I'm looking for in this particular question.

I tried Aleph.im's "aleph-vm" functions and this is the best one I've found so far. It actually does work but I think it only runs python code. The code I want to run is javascript. I ported my proof of concept code to python and it worked perfectly but my real code (which I'm keeping private for now) contains javascript libraries that don't exist in python.

I recently heard of Gelato functions but it's currently in a private beta (I don't have access).

I also got really close using Fluence Network. It's really interesting and runs serverless functions on public infrastructure. I got soooo close but it appears to have the same problem as Akash in the sense that deals expire and need to be renewed. I think renewing a deal creates a new URL which could brick my static site that calls out to a hardcoded url. Also, the typescript compiles to bytecode for something called aqua vm before it deploys, so I don't think that it allows importing external npm libraries. This kills my main use case for my private code.

So what am I missing? Is there a way to run serverless function code in a decentralized manner with a persistent connection string?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.