Back

CORS error executing function

  • 0
  • Functions
  • Web
mitsy0_0
26 May, 2023, 17:48

But got that huge error in website console(image above)

TL;DR
User is experiencing a CORS error while executing a function in their Nextjs tech stack. They are running the app locally and accessing it through a custom domain. Other users provide suggestions such as serving the app with a web server and checking API key permissions. Solution: Check if the function has execute access to the client API and add the platform in the console.
mitsy0_0
26 May, 2023, 18:15

just works in the appwrite console(

Drake
26 May, 2023, 18:16

CORS error executing function

mitsy0_0
26 May, 2023, 19:38

@Maniac_Fighter dont ghost😒

Maniac_Fighter
26 May, 2023, 19:39

If you try to execute the sample python code function from your web app, does it still throws an error?

Maniac_Fighter
26 May, 2023, 19:40

Also have you added the platform in the console?

Maniac_Fighter
26 May, 2023, 19:42

Does your function have execute access to the client api?

mitsy0_0
26 May, 2023, 19:47

I have specified "any" there in the function settings

mitsy0_0
26 May, 2023, 19:48

or are you talking about the permissions of the API key I used?

mitsy0_0
26 May, 2023, 19:51

here they are talking about setting the request's mode to 'no-cors'...(Just pointing out, Idk what that means)

Maniac_Fighter
26 May, 2023, 19:59

umm, can you show how you added a new platform in the console?

mitsy0_0
26 May, 2023, 20:06
mitsy0_0
26 May, 2023, 20:07

Is this what u talking about?

Drake
26 May, 2023, 20:20

Origin null seems odd...where is your app running?

mitsy0_0
26 May, 2023, 20:24

locally

Drake
26 May, 2023, 20:25

Can you provide more details? What's your tech stack?

mitsy0_0
26 May, 2023, 20:26

simple html, javascript :/

Drake
26 May, 2023, 20:29

How is it being served? What's the url you're using to access your app?

mitsy0_0
26 May, 2023, 20:31

um its running locally, so C:/Users...../index.html

Drake
26 May, 2023, 20:32

Ya maybe that doesn't work ...I think it needs to be served by some web server

Drake
26 May, 2023, 20:33

For example, look at this repo: https://github.com/appwrite/playground-for-web

mitsy0_0
26 May, 2023, 20:36

okay thanks, I'll into it πŸ™‚

bluesky
30 Nov, 2023, 06:39

Hello, I have same issue on this.

When I create custom domain on function, It's return cors

bluesky
30 Nov, 2023, 06:40

Tech stack: Nextjs

Running locally

Drake
30 Nov, 2023, 18:03

If you can't find the solution after searching, create a new <#1072905050399191082> post

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more