python-docs-samples icon indicating copy to clipboard operation
python-docs-samples copied to clipboard

CORS issue when running the firenotes example

Open paktree opened this issue 9 years ago • 6 comments

In which file did you encounter the issue?

python-docs-samples/appengine/standard/firebase/firenotes/

Did you change the file? If so, how?

I followed the instruction on the firenotes page to deploy the app to app engine

Describe the issue

When It's trying to save the note, it throws the following error in the browser console:

Failed to load resource: the server responded with a status of 500 () my-prototype.appspot.com/:1 XMLHttpRequest cannot load https://backend-dot-my-prototype.appspot.com/notes. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://my-prototype.appspot.com' is therefore not allowed access. The response had HTTP status code 500.

Any help would be appreciated.

paktree avatar Feb 22 '17 17:02 paktree

@paktree can you try using backend.my-prototype.appspot.com instead?

theacodes avatar Feb 22 '17 17:02 theacodes

@jonparrott. Ah, that makes sense. I'll give it a try, thanks!

paktree avatar Feb 22 '17 17:02 paktree

Let me know. It probably wouldn't kill us to add CORS headers to the backend anyway.

theacodes avatar Feb 22 '17 17:02 theacodes

@jonparrott no luck on that, I'm getting some certificate error after changing -dot- to "."

I found a SO that looks like -dot- is intended to get around the certificate issue: http://stackoverflow.com/questions/10283628/appengine-how-to-not-get-a-certificate-warning-with-backend-secure-connection

How do I add CORS headers to the backend? Or there is something I am missing?

paktree avatar Feb 23 '17 03:02 paktree

Just want to update this thread. After looking at the log, the CORS was not the culprit that causing this to fail. After starting from fresh, I was able to get it working. I may have run the pip install packages at the wrong directory and causing some missing libraries. But it's not obvious to catch at all.

Thanks!

paktree avatar Feb 24 '17 23:02 paktree

@paktree great, thanks for the update. Let us know if you have any other questions or comments about the code samples!

ryanmats avatar Feb 24 '17 23:02 ryanmats