I keep running into this error: ``` Error: Cannot ...
# general
d
I keep running into this error:
Copy code
Error: Cannot find module './about.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at app.get (/var/task/__index.js:9:22)
    at Layer.handle [as handle_request] (/var/task/node_modules/express/lib/router/layer.js:95:5)
    at next (/var/task/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/var/task/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/var/task/node_modules/express/lib/router/layer.js:95:5)
    at /var/task/node_modules/express/lib/router/index.js:281:22
When I try to serve a js file using:
Copy code
const server = new cloud.HttpServer("myexpress", () => {
  const app = express();
  app.get("/", (req, res) => {
    const page = require("./about.js");
    page.render(req, res);
  });

  return app;
});
The
require
points to the correct file path, but the lambda doesn't seem to recognize the file. I can even serve that file locally with this js function:
Copy code
const app = express();
app.get("/", (req, res) => {
    const page = require("./about.js");
    page.render(req, res);
});

app.listen(3030);
w
I believe you need to set the
cloud:functionIncludePaths
config variable to indicate custom file system paths you want to include in any functions. Without this, Pulumi will only include the source of your callback function and the required subset of node_modules in the Lambda. See https://pulumi.io/quickstart/cloudfx/#configuration.
❤️ 1
d
thank you so much! I would have never found that on my own 🙂