node-twitter-api-v2
node-twitter-api-v2 copied to clipboard
Issue with client.v2.tweet Function Not Returning Response and Freezing Server
I'm encountering an issue with the client.v2.tweet function from the Twitter API library within supabase cloud functions. The problem is that when I use this function to post a tweet, it doesn't seem to return a response as expected, and it leads to the server becoming unresponsive or freezing. but it does post the tweet to my twitter account.
code
const client = userClient.readWrite;
try{
const postTweet = await client.v2.tweet({text:tweetText});
// console.log(postTweet )
return new Response(
JSON.stringify({
message: postTweet,
}),
{ headers: { "Content-Type": "application/json" }, status: 200, },
);
}catch(e){
const error = {
message: e,
};
return new Response(
JSON.stringify(error),
{ headers: { "Content-Type": "application/json" },status:300 },
);
}
Please let me know if there are any suggestions or potential solutions to resolve this issue. Your assistance is greatly appreciated.
I am getting following error on my free account
data: {
title: 'Unsupported Authentication',
detail: 'Authenticating with OAuth 2.0 Application-Only is forbidden for this endpoint. Supported authentication types are [OAuth 1.0a User Context, OAuth 2.0 User Context].',
type: 'https://api.twitter.com/2/problems/unsupported-authentication',
status: 403
}
Do you have free or paid account?