linkResolver Problem


I am trying to get each blog url according to the response of graphql but it shows null (get uid).
Please see this attachment

And when I try to get url then it shows a GraphQL error, like this.

Here is my linkResolver


Please let me know the solution and what is the problem.

Hello @max.petrivskyi

Thanks for posting this question to us.

I have checked your repository and I haven't found any UID field in the blog_post_api Custom Type. Can you please confirm that?

Second thing, Can you please show your Linkresolver file? For this, please follow this guideline.


Hi, @Priyanka
Thanks for your support.

How about url?
Why does the error happen?

We use these URLs to create dynamic pages and to resolve internal links

After creating and registering the Link Resolver in the plugin, the routes become available in the url field in the metadata of the documents in the queries. The Link Resolver will create a unique URL path using each document's UID, like so: /blog/${doc.uid}.

You will find the complete information in the above link.


I've set all UID field and registered Link Resolver in

**gatsby-source-prismic** plugin

but can't get url properly.


Have you defined the Link Resolver function? If so Can you send me the screenshot of the code snippet of the linkResolver.js file?

Yes, I've defined.
Please this screenshot.

What is wrong?

Hello @max.petrivskyi

There are two issues with that:

  1. The linkResolver plugin option should be this: doc => linkResolver(doc) , not () => doc => linkResolver(doc)
  2. The Link Resolver function is exporting the function using exports.linkResolver . This means the linkResolver needs to be imported like this: const { linkResolver} = require("./src/utils/linkResolver")


It works well.

Many Thanks. :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.