Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS error when calling getTweet #153

Open
Amargol opened this issue Dec 21, 2023 · 4 comments
Open

CORS error when calling getTweet #153

Amargol opened this issue Dec 21, 2023 · 4 comments

Comments

@Amargol
Copy link

Amargol commented Dec 21, 2023

Hey, this is a great package. Thanks so much for the effort you all put into this.

I'm trying to use the included getTweet function to get metadata for a tweet given it's tweet id. But I get the following CORS error:

image

However, when I use the <Tweet /> component directly and pass in the ID, it gets the metadata for the tweet just fine.

Why does the CORS error occur when I call getTweet myself, but when the component calls it for me, everything works fine?

@Amargol Amargol changed the title CORD error when calling getTweet CORS error when calling getTweet Dec 21, 2023
@Amargol
Copy link
Author

Amargol commented Dec 24, 2023

Here's the code I'm using

image

@Yugi-2
Copy link

Yugi-2 commented Jan 23, 2024

I was able to resolve this by moving my getTweet wrapper function to a separate file and setting it as server action.

@iRajatDas
Copy link

getTweet works only in server side environment, try using server actions.

@wasifkareem
Copy link

wasifkareem commented Sep 1, 2024

Hi @iRajatDas , @Yugi-2 @Amargol , can you please elaborate, I'm trying to use gettweet() but its throwing cors, how to correctly set it in server action?? I have moved the the gettweet() wrapper function in separate folder and set it as "use server" , still throwing error
Screenshot from 2024-09-01 16-30-28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants