-
Notifications
You must be signed in to change notification settings - Fork 92
Closed
Labels
help wantedExtra attention is neededExtra attention is needed
Description
I have the following sitting in the AWS cloud API Gateway:
import Twitter from "twitter-lite";
import { success, failure } from "./libs/response-lib";
export async function main(event, context, callback) {
const data = JSON.parse(event.body);
const client = new Twitter({
subdomain: "api",
consumer_key: "redacted"
consumer_secret: "redacted"
access_token_key: "redacted"
access_token_secret: "redacted"
});
if(data.base64encodedimg)
{
try
{
client.subdomain = "upload";
const url = await client.post("media/upload", null, {
media_data: data.base64encodedimg,
});
client.subdomain ="api";
await client.post("statuses/update", null, {
status: data.tweet,
media_ids: url.media_id_string,
});
} catch (e) {
console.log(e);
callback(null, failure({ status: false }));
}
}
else
{
try
{
await client.post("statuses/update", null, {
status: data.tweet,
});
callback(null, success(data.tweet));
} catch (e) {
console.log(e);
callback(null, failure({ status: false }));
}
}
}I can fire off tweets all day long with a problem, but I'm not able to attach an image to them. Tweeting without an image works without a hitch as well.
I've gone through the painful process of ensuring that I'm actually sending along a base64 encoded image, so I know that's coming through as expected, at least to the gateway.
When this fails, all I receive back is a 500 response.
Thoughts?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed