Perhaps what am about to ask could have an older related topic. I have tried out a couple of react/contentful projects reading the documentation as i follow the tutorials Unfortunately the content isnot delivery to the web app from contentful.
Always get the error: ‘Resource could not be found’
The popular ‘Resort Beach Tutorial’ by John Smilga has been my most recent. I still got the same error. I think i have exhausted all the resources i could get my eyes on but i have not been able to fix this issue.
I need help!
@realsalimsema will need some more info to help troubleshoot why you’re running into this error. It would be helpful to see the code you’re using to prepare and make API requests. The first places I would think to check to make sure they’re correct
- Space ID
- Environment name
- Additional parameters, depending on the type of request (i.e. Entry ID)
If it’s an entry, it would also be important to double check that the entry being requested is published.
Sometimes it can be helpful to troubleshoot in an API tool like Postman to verify that you’re getting the expected response there.
Going to double check everything (React FrontEnd and Contentful). If the error persists then i will definetely get back here with a repo link for the code.
@blake.thompson : No Good Results Yet. I decided to create a simple react app to help me re-structure my question to be much clearer.
Contentful Model Entries.
- name(short text, required)
-description(long text, required)
Below is a link to screenshots of the files fetching data from contentful (Am relatively new to the community so i can not upload more than one image).
NB: There are only 3 with very precise code.
I think I’ve spotted your issue. When you’re creating your contentful client, you’re setting the space and access token to strings, when they should be variables.
and if those environment variables don’t hold your values then you’ll need to use a package like
dotenv to read your
@blake.thompson Initially the space and access variables where not strings but I had another error ‘Expected token parameter ‘, then I ignorantly tried that. The error mutated to “Resource can’t be found”.
Perhaps the .env file isn’t read. Hoping the dotenv package does fix it.