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

Issue: CORS Errors on Local Development #14

Open
seantcanavan opened this issue Apr 22, 2022 · 1 comment
Open

Issue: CORS Errors on Local Development #14

seantcanavan opened this issue Apr 22, 2022 · 1 comment

Comments

@seantcanavan
Copy link

I've put lmdrouter to huge success on live staging and production environments for lambda functions but I'm struggling to use it for debugging on local. Here's my main.go code:

func main() {
	environment := os.Getenv("STAGE")
	if environment == "staging" || environment == "production" {
		lambda.Start(router.Handler)
	} else {
		fmt.Println("Ready to listen and serve")
		err := http.ListenAndServe(":8080", http.HandlerFunc(router.ServeHTTP))
		if err != nil {
			log.Fatalf("%+v", err)
		}
	}
}

Assuming I'm using the library correctly - every request a browser makes via HTTPS results in a CORS error. Funny enough postman had no problem with using the endpoints locally over HTTPS so it's something to do with CORS and OPTIONS which I'm not an expert on by any means. Any ideas?

@seantcanavan
Copy link
Author

I have a local workaround working. I'll try to push a pull request up here in a little bit.

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

1 participant