Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative way to spin-up app in local without Contenful dependency #17

Open
ridhof opened this issue Mar 12, 2023 · 0 comments
Open

Comments

@ridhof
Copy link
Contributor

ridhof commented Mar 12, 2023

Hi, I tried to contribute today, but I feel like the Contentful dependency is painful.

without filling the .env with proper Contentful config, I got these error log:

wait  - compiling /_error (client and server)...
event - compiled client and server successfully in 136 ms (763 modules)
error - Error: Authentication failed. The access token you provided is invalid: {"response":{"error
":[{"message":"Authentication failed. The access token you provided is invalid","extensions":{"cont
ntful":{"code":"ACCESS_TOKEN_INVALID","requestId":"dc4c5adb-aa76-47bb-8367-897ad47cd8dc"}}}],"statu
":401,"headers":{}},"request":{"query":"query homePageQuery($locale: String!) {\n  eventCollection(
imit: 3, locale: $locale, order: startingDate_DESC) {\n    items {\n      ...RecentEventMetadata\n 
  }\n  }\n  sponsorCollection(order: name_ASC) {\n    items {\n      ...SponsorMetadata\n    }\n  }
n}\n\nfragment RecentEventMetadata on Event {\n  ...EventMetadata\n  sessionsCollection {\n    item
 {\n      sys {\n        id\n      }\n      speaker {\n        avatar {\n          url\n        }\n
       name\n      }\n    }\n  }\n}\n\nfragment EventMetadata on Event {\n  poster {\n    url\n  }\
  title\n  slug\n  description\n  category\n  startingDate\n  onlineEvent\n  location\n  url\n  quo
a\n  notes\n}\n\nfragment SponsorMetadata on Sponsor {\n  name\n  category\n  url\n  activeSponsor\
  logo {\n    url\n  }\n  sys {\n    id\n  }\n}","variables":{"locale":"en-US"}}}
wait  - compiling /404 (client and server)...

I tried to create a Contentful account so that I can fill the .env with my own keys, but it still gives me error.
It's saying that I don't have the certain table needed from the code shown below.

error - Error: Cannot query field "eventCollection" on type "Query". Did you mean "assetCollection
or "entryCollection"?: {"response":{"errors":[{"message":"Cannot query field \"eventCollection\" o
type \"Query\". Did you mean \"assetCollection\" or \"entryCollection\"?","locations":[{"line":2,"
lumn":3}]},{"message":"Cannot query field \"sponsorCollection\" on type \"Query\". Did you mean \"
setCollection\" or \"entryCollection\"?","locations":[{"line":7,"column":3}]},{"message":"Unknown 
pe \"Event\". Did you mean \"Int\"?","locations":[{"line":14,"column":33}]},{"message":"Unknown ty
 \"Event\". Did you mean \"Int\"?","locations":[{"line":31,"column":27}]},{"message":"Unknown type
"Sponsor\".","locations":[{"line":47,"column":29}]}],"status":400,"headers":{}},"request":{"query"
query homePageQuery($locale: String!) {\n  eventCollection(limit: 3, locale: $locale, order: start
gDate_DESC) {\n    items {\n      ...RecentEventMetadata\n    }\n  }\n  sponsorCollection(order: n
e_ASC) {\n    items {\n      ...SponsorMetadata\n    }\n  }\n}\n\nfragment RecentEventMetadata on 
ent {\n  ...EventMetadata\n  sessionsCollection {\n    items {\n      sys {\n        id\n      }\n
    speaker {\n        avatar {\n          url\n        }\n        name\n      }\n    }\n  }\n}\n\
ragment EventMetadata on Event {\n  poster {\n    url\n  }\n  title\n  slug\n  description\n  cate
ry\n  startingDate\n  onlineEvent\n  location\n  url\n  quota\n  notes\n}\n\nfragment SponsorMetad
a on Sponsor {\n  name\n  category\n  url\n  activeSponsor\n  logo {\n    url\n  }\n  sys {\n    i
n  }\n}","variables":{"locale":"en-US"}}}

It means that if Contentful connectivity is really needed to run the app locally, we need the exact tables and columns with the Surabayajs current production tables and columns.
So, we need a migrator?
I am not sure with that, because I am not familiar with a migrator, unless its SQL migrator.

So what?
I found a hacky way to "disable" Contentful connectivity, by replacing src/pages/index.tsx file on line 43 to be shown below:

// const data = await cms().homePageQuery({
  //   locale: i18n["i18n-code"][locale] as string,
  // });
  const data = { eventCollection: { items: null } };

I am curious on how are you going to handle this, like, its a barrier toward the open source.
Contributors might unable to contribute anything without knowing the way to hack the Contentful connectivity.

Thanks

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

No branches or pull requests

1 participant