butlerx / gatsby-source-google-spreadsheets

A source plugin for Gatsby that allows reading data from Google Sheets.
MIT License
39 stars 10 forks source link

Best I can tell, this plugin no longer works #40

Open jserrao opened 2 months ago

jserrao commented 2 months ago

If you implement everything correctly, builds will fail because this plugin is doing its credential work on the older open-ssl v2 standards. Gatsby 5.x requires node v18, which has open-ssl v3. I tried a number of different ways to get this to work but the credential issue was persistent.

Bug looks like this on build (both locally and up on Vercel for me):

 ERROR #11321  API.NODE.EXECUTION

"gatsby-source-google-spreadsheets" threw an error while running the sourceNodes lifecycle:

error:1E08010C:DECODER routines::unsupported

  Error: error:1E08010C:DECODER routines::unsupported

  - sig:131 Sign.sign
    node:internal/crypto/sig:131:29

  - index.js:152 Object.sign
    [project-name]/[jwa]/index.js:152:45

  - sign-stream.js:32 Object.jwsSign [as sign]
    [project-name]/[jws]/lib/sign-stream.js:32:24

  - index.js:225 GoogleToken.requestToken
    [project-name]/[gtoken]/build/src/index.js:225:31

  - index.js:163 GoogleToken.getTokenAsyncInner
    [project-name]/[gtoken]/build/src/index.js:163:21

  - index.js:142 GoogleToken.getTokenAsync
    [project-name]/[gtoken]/build/src/index.js:142:55

  - index.js:94 GoogleToken.getToken
    [project-name]/[gtoken]/build/src/index.js:94:21

  - jwtclient.js:158 JWT.refreshTokenNoCache
    [project-name]/[google-auth-library]/build/src/auth/jwtclient.js:158:36

  - oauth2client.js:143 JWT.refreshToken
    [project-name]/[google-auth-library]/build/src/auth/oauth2client.js:143:25

  - jwtclient.js:139 JWT.authorizeAsync
    [project-name]/[google-auth-library]/build/src/auth/jwtclient.js:139:35

  - jwtclient.js:135 JWT.authorize
    [project-name]/[google-auth-library]/build/src/auth/jwtclient.js:135:25

  - GoogleSpreadsheet.js:113 GoogleSpreadsheet.renewJwtAuth
    [project-name]/[google-spreadsheet]/lib/GoogleSpreadsheet.js:113:26

  - GoogleSpreadsheet.js:108 GoogleSpreadsheet.useServiceAccountAuth
    [project-name]/[google-spreadsheet]/lib/GoogleSpreadsheet.js:108:16

  - get.js:18 Object.<anonymous>
    [project-name]/[gatsby-source-google-spreadsheets]/lib/fetchSheet/get.js:18:23

  - Generator.next

  - get.js:8
    [project-name]/[gatsby-source-google-spreadsheets]/lib/fetchSheet/get.js:8:71
jserrao commented 2 months ago

The solution is to reengineer your integration with the googleapis library and do the work directly. It's not that much more work but it's another thing you have to handle. I can write up my solution if anybody wants it, just let me know.