freezing-house-86375
02/19/2019, 8:18 AMimport * as cloud from "@pulumi/cloud";
import * as pulumi from "@pulumi/pulumi";
const app = new cloud.API("my-app");
const config = new pulumi.Config();
const test = config.require("sendgrid_apikey");
// Serve a simple REST API on `GET /hello`:
app.get("/hello", async (_, res) => {
res.json({
cred: test
});
});
export let url = app.publish().url;
That code, and this code
import * as cloud from "@pulumi/cloud";
import * as pulumi from "@pulumi/pulumi";
const app = new cloud.API("my-app");
const config = new pulumi.Config();
// Serve a simple REST API on `GET /hello`:
app.get("/hello", async (_, res) => {
res.json({
cred: config.require("sendgrid_apikey")
});
});
export let url = app.publish().url;
The first one works, but the second one throws error like this
2019-02-19T15:13:34.381+07:00[ my-app1c06b73d] (node:1) UnhandledPromiseRejectionWarning: Error: Cannot find module '@pulumi/pulumi/runtime/index.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 /var/task/__index.js:238:23
at __f3.__f4 (/var/task/__index.js:269:6)
at __f3.<anonymous> (/var/task/__index.js:374:24)
at __f3.__f14 (/var/task/__index.js:382:34)
at /var/task/__index.js:451:22
at Generator.next (<anonymous>)
gentle-diamond-70147
02/19/2019, 3:33 PMnpm install
for the second one to install the project's dependencies.freezing-house-86375
02/20/2019, 3:31 AMrequire
twitter
inside the cloud.timer.interval
callback. Instead of importing it on top of the file. Is it somehow related?
Can’t config.require(..)
inside callback and have to require
twitter
inside the callback?