How to create unique Gatsby node ids  🏷 

All Gatsby nodes need a unique id. Luckily for you, a Gatsby Source Plugin developer, you are not responsible for creating unique ids. You are only responsible for supplying a unique-within-your-universe-id to createNodeId. Gatsby is responsible for returning a unique node id.

exports.sourceNodes = async ({ actions, createNodeId }) => {
  const { createNode } = actions;

    id: createNodeId("unique-within-your-universe-id"),

    // More fields

In Gatsby Source YouTube oEmbed we use the YouTube id. It is unique across the YouTube universe.

All the best,
Queen Raae

PS: createNodeId is deterministic

Stuck on a reef in the sharky waters around the Gatsby islands?

Book a 1-on-1 Gatsby Call with Queen Raae. Friendly advice you can put into action immediately, guaranteed!

Serious about Gatsby? Sign up for emails sent every weekday to help you get the most out of Gatsby!