google-cloud-functionsmarko

Google Cloud Functions doesn't load file directory correctly


I'm building a little function that sends mails through Google Cloud Functions.

For templating i'm using Marko.js.

When i do a require to a folder, returns a strange require with some numbers on path that doesnt exist on my local development.

Do you know if it's possible to point folders?enter image description here


Solution

  • Fixed guys, the error is not that the path is not found, is EROFS (read-file system)

    MarkoJS generates .js files dynamically, the cloud functions are read-file system server, so we have two options here:

    1. Don't generate Marko files:
    require('marko/compiler').defaultOptions.writeToDisk = false; 
    
    1. Or just store them in /tmp folder, is the only dir allowed to write from cloud functions