Cannot read property 'length' of undefined or CORS
benoittgt opened this issue · comments
Hello
Is there any updates on Google API? I looked at https://medium.com/@ryan.mcnierney/using-react-google-sheets-as-your-cms-294c02561d59 and the code was working. The spreadsheet id too.
I tried to redo the example with my own spreadsheet and it failed:
The spreadsheet https://docs.google.com/spreadsheets/d/111_7rU2qfo73sna0_ZcFt9QLFqTPl9LqevS3FIfHlio/edit#gid=0
- If I use the the key
111_7rU2qfo73sna0_ZcFt9QLFqTPl9LqevS3FIfHlio
and the sheets has been "published on the web" and I grab the id from the url.
Uncaught TypeError: Cannot read property 'length' of undefined
at Tabletop.loadSheets (tabletop.js:358)
at XMLHttpRequest.xhr.onload (tabletop.js:219)
- If I remove the publish on the web and the sheet is still accessible from outside.
Access to XMLHttpRequest at 'https://accounts.google.com/ServiceLogin?service=wise&passive=1209600&continue=https://spreadsheets.google.com/feeds/worksheets/111_7rU2qfo73sna0_ZcFt9QLFqTPl9LqevS3FIfHlio/public/basic?alt%3Djson&followup=https://spreadsheets.google.com/feeds/worksheets/111_7rU2qfo73sna0_ZcFt9QLFqTPl9LqevS3FIfHlio/public/basic?alt%3Djson<mpl=sheets' (redirected from 'https://spreadsheets.google.com/feeds/worksheets/111_7rU2qfo73sna0_ZcFt9QLFqTPl9LqevS3FIfHlio/public/basic?alt=json') from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
App to reproduce the error: https://github.com/benoittgt/recubieration
Maybe related to #183 (comment)
Ok I disable the "publish on the web". Then we republished only the sheet I want to be published, also tick "update on change". Then grab the url of my browser (not the one in the publish on the web popup).
It works: benoittgt/recubieration@128fad0