wilkerlucio
09/02/2017, 3:48 PMnilan
09/02/2017, 3:49 PMwilkerlucio
09/02/2017, 4:03 PMnilan
09/02/2017, 4:04 PMTRANSFORM_ARGUMENT
wilkerlucio
09/02/2017, 4:06 PMfetch
the script stops compiling without giving me any error message (it seems to fallback to the latest working version, ignoring new code)wilkerlucio
09/02/2017, 4:06 PMwilkerlucio
09/02/2017, 4:06 PM'use latest'
require('isomorphic-fetch');
module.exports = async function (event) {
const query = `
user(login: "${event.data.github}") {
id
}
`;
console.log("bla")
const req = await fetch("<https://api.github.com/graphql?access_token=...>", {
method: "post",
headers: {"content-type" "application/json"},
body: JSON.stringify({query})
});
const json = await req.json();
console.log(json);
return {data: event.data};
};
nilan
09/02/2017, 4:06 PMnilan
09/02/2017, 4:07 PMnilan
09/02/2017, 4:07 PMwilkerlucio
09/02/2017, 4:07 PMwilkerlucio
09/02/2017, 4:07 PM'use latest'
require('isomorphic-fetch');
module.exports = function (event) {
const query = `
user(login: "${event.data.github}") {
id
}
`;
return fetch("<https://api.github.com/graphql?access_token=...>", {
method: "post",
headers: {"content-type" "application/json"},
body: JSON.stringify({query})
}).then((r) => {
return r.json()
}).then((response) => {
console.log(response);
return {data: event.data}
}).catch((err) => {
console.log(error);
return {error: 'Could not connect to Movie API'};
});
};
wilkerlucio
09/02/2017, 4:08 PMconsole.log(fetch)
, it logs null, is that normal?nilan
09/02/2017, 4:09 PMwilkerlucio
09/02/2017, 4:10 PM