Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

CORS #8

Closed
samsammurphy opened this issue Mar 27, 2018 · 13 comments
Closed

CORS #8

samsammurphy opened this issue Mar 27, 2018 · 13 comments

Comments

@samsammurphy
Copy link
Contributor

samsammurphy commented Mar 27, 2018

I am hitting CORS issue that is very similar to the one described for the landast-tiler. However, this time setting a AWS_REGION variable doesn't seem to fix the problem.

After digging around a little in the serverless issues (e.g. #4681) it seems that maybe we need to define Access-Control-Allow-* headers ?

If you want to use CORS with the lambda-proxy integration, remember to include the Access-Control-Allow-* headers in your headers object

As defined in the serverless docs

Here is a screenshot of how it looks on the frontend:
sentinel2_cors_blocked

@vincentsarago
Copy link
Contributor

I think this happened with the new serverless release, can you confirm which version of serverless you are using ?
I may need to update https://github.com/vincentsarago/lambda-proxy which is handling the api-gateway integration.

@samsammurphy
Copy link
Contributor Author

$ sls --version
1.26.0

I am going to try and play with this again over the weekend to see if I didn't miss something.

@samsammurphy
Copy link
Contributor Author

One idea might be to add the following line

"Access-Control-Allow-Credentials" : true // Required for cookies, authorization headers with HTTPS

to here perhaps?

I am not at all familiar with lambda proxies though, so that is a bit of a guess. Again, will try testing over the wkd.

@vincentsarago
Copy link
Contributor

@samsammurphy I can't reproduce this but with sls 1.26.1 (event with Access-Control-Allow-Credentials set or not) is your endpoint still up and running ?

@samsammurphy
Copy link
Contributor Author

samsammurphy commented Apr 2, 2018

I had removed it.. new endpoint up

const sentinel_tiler_url = 'https://r1jzg3qt9c.execute-api.eu-central-1.amazonaws.com/dev'

there is no CORS error, but it still is hitting something.. hopefully will find more info to help diagnose..

@samsammurphy
Copy link
Contributor Author

In the initScene() function there is a query for metadata on line 91.

Here is an example of one of my query urls:
https://r1jzg3qt9c.execute-api.eu-central-1.amazonaws.com/dev/sentinel/metadata/S2B_tile_20180303_17SMD_0?'pmim=5&pmax=95

here is part of a response from jquery .fail() when trying to $.getJSON such a query:

responseJSON: Object { errorMessage: "A defined coordinate reference system is required" }
responseText: "{\"errorMessage\": \"A defined coordinate reference system is required\"}"
setRequestHeader: function setRequestHeader()
state: function state()
status: 500
statusCode: function statusCode()
statusText: "Internal Server Error"

As you see the error message is "A defined coordinate reference system is required". I'm not sure why that error is raised. Any ideas?

@Dharnidharka
Copy link

@samsammurphy I am running into the same issue "A defined coordinate reference system is required". Have you been able to figure out the cause? landsat-tiler works normally though.

@vincentsarago
Copy link
Contributor

are you using the simple or custom build ?
if you are using the simple you need to remove https://github.com/mapbox/sentinel-tiler/blob/master/serverless.yml#L18
cc @samsammurphy @Dharnidharka

@Dharnidharka
Copy link

@vincentsarago I am using the simple build. I'll make the suggested fix and get back to you. Thank you.

@Dharnidharka
Copy link

@vincentsarago Removing the line has resolved the issue. Thanks a lot.

@vincentsarago
Copy link
Contributor

no problem @Dharnidharka, btw just checked your web, seems you are doing great stuff, love to see what you'll do with sentinel-tiler :-)

sorry @samsammurphy I should have realized that 21 days ago 🤦‍♂️,

Feel free to close here if it also worked for you

@Dharnidharka
Copy link

@vincentsarago Thank you. I recently started exploring satellite imagery and this tool is simply awesome. Will let you know if I manage to do something worthwhile on top of it :)

@samsammurphy
Copy link
Contributor Author

🎉 that worked. thanks @vincentsarago !

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

No branches or pull requests

3 participants