sparse-intern-71089
08/10/2018, 8:55 PMwhite-balloon-205
axios
, fetch
or request
are simple options (on NPM).dazzling-scientist-80826
08/10/2018, 9:05 PMdazzling-scientist-80826
08/10/2018, 9:09 PMdazzling-scientist-80826
08/10/2018, 9:10 PMerror: Error serializing '(event) => __awaiter(this, void 0, v ...': index.js(77,68)
'(event) => __awaiter(this, void 0, v ...': index.js(77,68): captured
module './node_modules/axios/index.js' which indirectly referenced
function 'wrap': bind.js(4,22): which captured
'fn', a function defined at
function 'request': Axios.js(26,42): which captured
module './node_modules/axios/lib/defaults.js' which indirectly referenced
function 'httpAdapter': http.js(17,37): which captured
module 'url' which indirectly referenced
function 'urlParse': url.js(96,17): which referenced
function 'Url': url.js(44,12): which referenced
function 'parse': url.js(104,36): which captured
variable 'errors' which indirectly referenced
function 'NodeError': errors.js(24,15): which referenced
function 'message': errors.js(103,16): which captured
variable 'messages' which indirectly referenced
function 'get': which could not be serialized because
it was a native code function.
Function code:
function get() { [native code] }
Capturing modules can sometimes cause problems.
Consider using import('./node_modules/axios/index.js') or require('./node_modules/axios/index.js') inside '(event) => __awaiter(this, void 0, v ...': index.js(77,68)
error: an unhandled error occurred: Program exited with non-zero exit code: 1
error: an error occurred while advancing the preview
white-balloon-205
0.15.0
(should be Monday), you will need to import axios
inside your function:
let f = new aws.Serverless.Function("f", { ...}, async (ev, ctx) => {
let axios = await import("axios"); // or let axios = require("axios");
});
With 0.15.0
you will be able to import ant the top of the file and use inside runtime functions.
cc @lemon-spoon-91807dazzling-scientist-80826
08/10/2018, 9:15 PMlemon-spoon-91807
08/10/2018, 9:16 PMlemon-spoon-91807
08/10/2018, 9:16 PMlemon-spoon-91807
08/10/2018, 9:16 PMdazzling-scientist-80826
08/10/2018, 9:17 PMaxios
this way somehow?lemon-spoon-91807
08/10/2018, 9:17 PMwhite-balloon-205
let axios = await import("axios");
will bring in types.dazzling-scientist-80826
08/10/2018, 9:17 PMlemon-spoon-91807
08/10/2018, 9:18 PMlemon-spoon-91807
08/10/2018, 9:18 PMlemon-spoon-91807
08/10/2018, 9:18 PMdazzling-scientist-80826
08/10/2018, 9:18 PM.default
lemon-spoon-91807
08/10/2018, 9:18 PMdazzling-scientist-80826
08/10/2018, 9:18 PMlemon-spoon-91807
08/10/2018, 9:19 PMlemon-spoon-91807
08/10/2018, 9:19 PM