Issues when executing Gatsby Develop for portfolio template

Hello I am using the portfolio template provided and having issues when running Gatsby Develop. I’ve develop the sock store before with no issues as I am learning Gatsby. Thank you for your help!

UNHANDLED REJECTION Cannot read property ‘allDatoCmsWork’ of undefined

TypeError: Cannot read property ‘allDatoCmsWork’ of undefi ned

  • gatsby-node.js:19
    /Users/khoi-inviscus/Dropbox/khoiInviscus/thegreenstain/ gatsby-node.js:19:19

hello @khoi welcome to Community :slight_smile:

if you are encountering that error it might mean that in your project you don’t have a model with API key “work”.

Can you please check that?


Sorry for the noob response but where can I possibly find that? Only place I am familiar with API is from “DATO_API_TOKEN=”

which is stored in my “.env.development” file and inside gatsby.config


That’s fine, if you don’t set the DATO_API_TOKEN you’ll get a different error on the endpoint.

Your error means that you don’t have a model in your schema with that API key, meaning the name of the model that gets exposed to the API. Can you double check if you have a “Work” model with a “work” API key?

I have followed the instructions and inserted my read only key inside my .env file . However I still get “UNHANDLED REJECTION Cannot read property ‘allDatoCmsWork’ of undefined”. So like this:


What do I do wrong?

hello @aroble48 and welcome! :slight_smile:

can you please share the repository that you are using so that I can try reproducing the error myself?

I managed to get it working. I used example portfolio u provided in the tutorial.