Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Request retrieving error 404 #14

Closed
Fichtner21 opened this issue Aug 17, 2021 · 14 comments
Closed

Request retrieving error 404 #14

Fichtner21 opened this issue Aug 17, 2021 · 14 comments

Comments

@Fichtner21
Copy link

Hi in my existing project i use your package, but in a few last days my website in not working becasue i have error in every single tab from google sheets, for example like this below. U can help? Thanks!

main.js:353 Uncaught (in promise) Error: Error 404 retrieving https://spreadsheets.google.com/feeds/list/1w_WHqCutkp_S6KveKyu4mNaG76C5dIlDwKw-A-dEOLo/7/public/values?alt=json
at main.js:353
at async main.js:353
at async async.sheet (main.js:353)

@franciscop
Copy link
Owner

Could you please share some of the relevant code? for example line 353 and +- 10 lines of main.js

@mohammedfarish
Copy link

mohammedfarish commented Aug 18, 2021

I'm getting similar issues too. Looks like google has changed their method. about serving data as json

here's how my code looks like.

router.route('/data').get(async (req, res) => Drive({
  sheet: sheetId,
  tab: "4"
})
  .then((result) => {
    // doing something here
    res.status(200);
  })
  .catch((err) => console.log(err)));

Here's how the logs look like.

Error: Error 404 retrieving https://spreadsheets.google.com/feeds/list/1oM-bv-UfVtbrUp9_M0R4NJLQKZCMUnVMOJ50ADBNxPo/2/public/values?alt=json
    at ClientRequest.handler (/Users/farish/Files/code/node_modules/drive-db/index.min.js:1:752)
    at Object.onceWrapper (events.js:417:26)
    at ClientRequest.emit (events.js:310:20)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
    at TLSSocket.socketOnData (_http_client.js:469:22)
    at TLSSocket.emit (events.js:310:20)
    at addChunk (_stream_readable.js:286:12)
    at readableAddChunk (_stream_readable.js:268:9)
    at TLSSocket.Readable.push (_stream_readable.js:209:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)

The above link returns this page
image

@Fichtner21
Copy link
Author

Thanks for the reply! What now? There is something new in google documentation about google sheets? Rewrite method?

@Fichtner21
Copy link
Author

I think this is the reason (API v3 -> v4) https://developers.google.com/sheets/api/guides/migration

@franciscop
Copy link
Owner

Is the spreadsheet public? I cannot seem to read it, which might be because it's private. Please read and follow the bold text in the Getting Started:

https://github.com/franciscop/drive-db#getting-started

File > Publish to the Web > Publish

This library is for simple, public access, so the spreadsheets need to be made public.

@franciscop
Copy link
Owner

image

@Fichtner21
Copy link
Author

Yep ofc its public (for sure, i checked this yesterday, until i leave you comments), i used your package since 10 November 2020, and everything working well until august began. I think maybe is something with change API, i have the same problem, but in different project based on Angular (error 404).

@Fichtner21
Copy link
Author

Zrzut ekranu 2021-08-18 o 15 02 06

@franciscop
Copy link
Owner

You are right, I can see:

In the new Sheets API v4, there is no explicit declaration of visibility. API calls are made using spreadsheet IDs. If the application does not have permission to access specified spreadsheet, an error is returned. Otherwise the call proceeds.

And tests are failing locally. Let me search a bit, but if the old API was killed that might be about the end of it...

@Fichtner21
Copy link
Author

Yep, maybe other approach? I see tutorial to migrate from v3 to v4 and there is many changes. Its a pity such a policy is used by google.

@mohammedfarish
Copy link

After a quick glance at the new API v4, it appears to be mandatory for each request to be authenticated.

@patrickblackjr
Copy link

patrickblackjr commented Aug 23, 2021

Same issue for me for a project.

spreadsheet

When I grabbed the new spreadsheet URL is seems to be working without authentication so I think "just" rewriting the method should resolve the issue?

@franciscop
Copy link
Owner

After a quick glance at the new API v4, it appears to be mandatory for each request to be authenticated.

Yes unfortunately that seems to be the issue, unless I can find some solution this might be the death of this library...

I think "just" rewriting the method should resolve the issue?

That returns an HTML string, that luckily works even with a cross-site request, so there is hope. However, I do not yearn to parse HTML manually, and since drive-db works both in the front-end and Node.js it's also not possible to use browser-parsing methods easily without loading the whole jsdom or similar in the backend. Another worry is that the URL you shared seems to be using some obscure, v3-like API which means it could also stop working at any time. So the idea of putting weeks of work here to maybe have it just discontinued is not very positive.

@franciscop
Copy link
Owner

I've been searching and trying things in vain, unfortunately it seems this is the death of this library...

I put a notice in the repository, and will shortly add one in npm. Thank you so much everyone for using the library so far, hope you find a suitable replacement for your usecase!

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

4 participants