cedricdelpoux / gatsby-source-google-docs

Gatsby plugin to use Google Docs as a data source
https://cedricdelpoux.github.io/gatsby-source-google-docs/
MIT License
212 stars 55 forks source link

warn source-google-docs: HTTPError: Unable to fetch: https://lh3.googleusercontent.com/docs/XXXX #219

Closed anthonyandmaiwang closed 1 year ago

anthonyandmaiwang commented 1 year ago

For some reason none of my images are fetchable anymore. I regenerated .env and created a new client id/secret, but no luck.

I'm seeing the error:

Your client does not have permission to get URL

/fife/XXXXXXX from this server.

ACL Denied That’s all we know.
Reason: Response code 403 (Forbidden)
---
Fetch details:
{
  "attempt": 3,
  "method": "GET",
  "errorCode": "ERR_NON_2XX_3XX_RESPONSE",
  "responseStatusCode": 403,
  "responseStatusMessage": "Forbidden",
  "requestHeaders": {
    "user-agent": "got (https://github.com/sindresorhus/got)",
    "accept-encoding": "gzip, deflate, br"
  },
  "responseHeaders": {
    "content-type": "text/html; charset=UTF-8",
    "x-content-type-options": "nosniff",
    "content-encoding": "gzip",
    "date": "Thu, 23 Mar 2023 22:47:27 GMT",
    "server": "fife",
    "cache-control": "private",
    "x-xss-protection": "0",
    "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
    "connection": "close",
    "transfer-encoding": "chunked"
  }
}

Edit: This plugin is able to fetch the documents and text portions fine. It's just the images that aren't being pulled anymore

linoxyn commented 1 year ago

I've also just encountered the same issue. I have two similar projects, one I have regenerated .env Client ID, Client Secret, and Token with all packages updated. The other has not been updated and worked with no errors since it's last build and deploy 11/01/2022. I am able to query and access images from Docs in Google's Workspace Explorer without issue.

warn source-google-docs: HTTPError: Unable to fetch: https://lh3.googleusercontent.com/docs/AG8NV2a1Kv6Sv0DLVE-ip1_j2sk8Tppie0RemOxZhtvLKVYZM-DHW_gHO6Y8oY05Ux3YeBR10RWOPcXgace23hhOgou-le8r33qP bTAqG9mrVZwHeMHdWZvy8oCiEZZNL_QYrtU-jFSTNA3x7DbVa6Rs_iQyRn3vsValT6VShuE4u65OPZ9KLYAgVbPye1xmIvk

Reason: Response code 403 (Forbidden)

Fetch details: { "attempt": 3, "method": "GET", "errorCode": "ERR_NON_2XX_3XX_RESPONSE", "responseStatusCode": 403, "responseStatusMessage": "Forbidden", "requestHeaders": { "user-agent": "got (https://github.com/sindresorhus/got)", "accept-encoding": "gzip, deflate, br" }, "responseHeaders": { "content-type": "text/html; charset=UTF-8", "x-content-type-options": "nosniff", "content-encoding": "gzip", "date": "Fri, 24 Mar 2023 15:41:31 GMT", "server": "fife", "cache-control": "private", "x-xss-protection": "0", "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000", "connection": "close", "transfer-encoding": "chunked" } }

cedricdelpoux commented 1 year ago

Hello, thanks for reporting this. Could you try the last 2.4.0 version?

linoxyn commented 1 year ago

Thank you @cedricdelpoux for looking into this issue. I have updated to 2.4.0 version.

I am getting a new error:
ModuleNotFoundError: Module not found: Error: Can't resolve 'gatsby-core-utils/create-content-digest' in 'C:\Projects\johnhansenartist.cache\slice'

Even after running gatsby clean Development fails to complete.

The error message for image files has changed to:


success source-google-docs: "Candles and Rose - Final" document - 4.326s - 0/1 images fetched
warn source-google-docs: HTTPError: Unable to fetch: https://lh3.googleusercontent.com/docs/AG8NV2YAfHr63pSYIZm5LZFGrC2Br6PFmSZy1C6pkqhbT_OlP3zevntP5QCBHIuzhRH m1sEQ21D6bv4sgwYA-KwWSg0ir6HPMDpOVw_1aSt_8Ht68YtU6Z0SopMuKs5zaA-5srqSOjC_rOx2fEPeS_xrsZpKp3WK8Sf1-1K7eSbLw nWyEqkC3Zda456D-3G62kDF

Reason: Response code 403 (Forbidden)

Fetch details: { "attempt": 3, "method": "GET", "errorCode": "ERR_NON_2XX_3XX_RESPONSE", "responseStatusCode": 403, "responseStatusMessage": "Forbidden", "requestHeaders": { "user-agent": "got (https://github.com/sindresorhus/got)", "accept-encoding": "gzip, deflate, br" }, "responseHeaders": { "content-type": "text/html; charset=UTF-8", "x-content-type-options": "nosniff", "content-encoding": "gzip", "date": "Mon, 27 Mar 2023 13:53:47 GMT", "server": "fife", "cache-control": "private", "x-xss-protection": "0", "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000", "connection": "close", "transfer-encoding": "chunked" } }

linoxyn commented 1 year ago

I just was trying to find out if any other changes within Google Drive/Docs that may be causing this issue. One finding suggested to make sure that the Manage Accessis properly set. I made sure to update the the main project folder being accessed by the gatsby-source-google-docs plugin on Drive to also include General Access: Anyone on the internet with the link can view Odd that this wasn't an issue before?

This change fixed the 403 Forbidden error.

Problem now is that in my fully updated pkgs project I am now getting can't resolve gatsby-core-utils/create-content-digest issue! Looking for a fix for that! 🤔

Thank you for your help @cedricdelpoux

cedricdelpoux commented 1 year ago

I can't reproduce your Can't resolve 'gatsby-core-utils/create-content-digest' error. Could you try remove your nodes_modules and reinstall?

I already noticed that having the main folder Public is a workaround. Bit I don't know how to fix the 403 Forbidden error for now. Help is appreciated

cedricdelpoux commented 1 year ago

I think I found the fix. I just published a 2.4.1 version. You need to generate a new token because the scope and authorisations changed

linoxyn commented 1 year ago

Thank you @cedricdelpoux this version 2.4.1 has fixed the issue. I was able to return the Drive folder's security back to the protected state. I should have also realized that removing the node_modules would have been the thing to try and fix that create-content-digest error/fail. All is good. Thank you very much! 😊