Nuxt-storyblok - resolve_relations adds resolved relation in separate rels array instead of part of the story?

I’m following this guide on how to setup a blog with Nuxt and Storyblok: Show the Blog Content in Nuxt Using Storyblok API - Storyblok

However, the guide mentioned on the part of resolving the relation with authors that the following request:

async asyncData({ app }) {
    const res = await app.$storyapi.get('cdn/stories', {
      starts_with: 'articles/',
      resolve_relations: 'author',
    })
 
    // Let's convert content.date from a String to a Date
    const articles = res.data.stories.map((story) => {
      story.content.date = new Date(story.content.date)
      return story
    })
 
    return { articles }
  },

Would give the following JSON output, i.e. the complete resolved author object is part of the content of the story:

{
  "stories": [
    {
      "name": "Top 3 Genjutsu techniques",
      "created_at": "2020-07-21T09:40:10.440Z",
      "published_at": "2020-07-21T17:49:48.887Z",
 
      "id": 15872750,
      "uuid": "ae259808-1cf8-471b-92f2-1995d006a6d4",
      "content": {
        "_uid": "749bece0-08d2-49e4-a56a-f7e42ca50286",
        "date": "2020-07-09 22:57",
        "title": "Top 3 Genjutsu techniques",
        "author": {
          "name": "Naruto Uzumaki",
          "created_at": "2020-07-21T15:41:50.969Z",
          "published_at": "2020-07-21T15:47:21.810Z",
          "id": 15904544,
          "uuid": "80a3e586-5d85-47af-851e-c3c60454dd9f",
          "content": {
            "bio": "Enthusiastic and beloved Hokage from the Konoha village. He never get's back on his word, that's his ninja way.",
            "_uid": "eeb81ebd-39c2-47ce-99f4-dc5c6f4054a0",
            "name": "Naruto Uzumaki",
            "avatar": {
              "id": 1268292,
              "alt": null,
              "name": "",
              "focus": null,
              "title": null,
              "filename": "<https://a.storyblok.com/f/89259/500x500/dad7790433/naruto-avatar.jpg>",
              "copyright": null,
              "fieldtype": "asset"
            },
            "component": "Author"
          },
          "slug": "naruto-uzumaki",
          "full_slug": "authors/naruto-uzumaki",
          "default_full_slug": null,
// ...

However, I’m currently using the "storyblok-nuxt": "2.0.1" package and my resolved relation does not appear as part of the story content on the first request after booting up localhost but instead only appears in a sibling rels array (weird thing is that the complete author object does appear as part of the story content on subsequent requests).

{
  data: {
    stories: [
      {
        name: 'Top 3 Genjutsu techniques',
        created_at: '2021-11-10T22:09:25.101Z',
        published_at: '2021-11-10T22:31:22.090Z',
        id: 84670145,
        uuid: '62ebedae-1833-430d-b987-06b87dc461c2',
        content: {
          _uid: 'd07b15f3-c94c-4fc2-bcc9-c0fc7b000b01',
          date: '2021-11-10 00:00',
          title: 'Top 3 Genjutsu techniques',
          author: 'd50f2763-4de4-44f7-81a1-fd5b484e48c8',
          content: 'Lorem ipsum **dalar** set',
          component: 'Article',
          description: 'This article guides you through all the steps to make an article shine with your favourite framework, Vue'
        },
        slug: 'top-3-genjutsu-techniques',
        full_slug: 'articles/top-3-genjutsu-techniques',
        sort_by_date: null,
        position: 0,
        tag_list: [ 'Genjutsu', 'Techniques' ],
        is_startpage: false,
        parent_id: 84670144,
        meta_data: null,
        group_id: 'f047befc-3897-464f-bf17-a832f3e3682d',
        first_published_at: '2021-11-10T22:31:19.575Z',
        release_id: null,
        lang: 'default',
        path: null,
        alternates: [],
        default_full_slug: null,
        translated_slugs: null
      }
    ],
    cv: 1636585026,
    rels: [
      {
        name: 'Woet',
        created_at: '2021-11-10T22:14:21.399Z',
        published_at: '2021-11-10T22:52:39.934Z',
        id: 84670147,
        uuid: 'd50f2763-4de4-44f7-81a1-fd5b484e48c8',
        content: {
          bio: 'This is me',
          _uid: 'd2f6c76f-1db4-4bad-95ac-ce66cfd28632',
          name: 'Woet',
          avatar: {
            id: 3219538,
            alt: '',
            name: '',
            focus: null,
            title: '',
            filename: 'https://a.storyblok.com/f/134266/6000x4000/ceca4a4aab/1.JPG',
            copyright: '',
            fieldtype: 'asset'
          },
          component: 'Author'
        },
        slug: 'woet',
        full_slug: 'authors/woet',
        sort_by_date: null,
        position: 0,
        tag_list: [],
        is_startpage: false,
        parent_id: 84670146,
        meta_data: null,
        group_id: 'a9e112c8-7d8f-40e6-887f-aac573ba75e3',
        first_published_at: '2021-11-10T22:31:30.000Z',
        release_id: null,
        lang: 'default',
        path: null,
        alternates: [],
        default_full_slug: null,
        translated_slugs: null
      }
    ],
    links: []
  },
  headers: {
    ...
  }
}

So I’m not sure if this is a Nuxt problem or something specific to the resolve_relations of Storyblok that I’m missing, but why is author: 'd50f2763-4de4-44f7-81a1-fd5b484e48c8' not resolved as part of the story content on the first request after booting up my dev server?

Any response on this?

Hello @MBrunner & @Woet,

the storyblok-nuxt module uses the JS client which is visible here storyblok-nuxt/package.json at master · storyblok/storyblok-nuxt · GitHub and the JS client inserts the story objects from the rels array into the places where they have been referenced with the code here storyblok-js-client/index.js at master · storyblok/storyblok-js-client · GitHub

Important to know is that when you pass the parameter resolve_relations: to the storyblok-nuxt module that you need to use the component and the field name with the UUID as mentioned in the documentation - Storyblok API Documentationresolve_relations

So in your case, you would need to pass Article.author as the value to the resolve_relations parameter.

Best regards
Hannes