title: using map to create a new plain object in Sequelize
body: <p>i am trying to map my conversation array to create a new object with url and thumbnail url instead of the image file name.</p>
  <pre><code>router.get('/', auth, async (req, res) =&gt; {
  const conversations = await Conversation.findAll({
    include: [
    //   {
    //   model: Message,
    //   where: {
    //     [Op.or]: [
    //       { senderId: req.user.id }, 
    //       { receiverId: req.user.id },
    //     ],
    //   },
    //   required: true, // RIGHT  JOIN
    // },
    {
      Post,
      attributes:[&quot;id&quot;,&quot;title&quot;,&quot;userId&quot;],
      include: [
        { model: User, attributes: [&quot;id&quot;, &quot;name&quot;, &quot;email&quot;] },
      { model: Post_Image, attributes: [&quot;id&quot;, &quot;images&quot;] },
      ],
    }
  ],
  });
  
  if (!conversations) return res.status(404).send();
  
  const baseUrl = config.get(&quot;assetsBaseUrl&quot;);
  
  const plainConversations = conversations.map(x=&gt;x.get({ plain: true }));
  const resultPosts = [];
  for (const post of plainConversations) {
    const { Post_Images, ...postAttributes } = post;
    const IMAGES = Post_Images.map((postImage) =&gt; ({
      url: `${baseUrl}${postImage.images}_full.jpg`,
      thumbnailUrl: `${baseUrl}${postImage.images}_thumb.jpg`,
    }));
  
    resultPosts.push({ ...postAttributes, images: IMAGES });
  }
  res.send(resultPosts);
  
  });
  </code></pre>
  <p>when i try this code i keep getting cannot read property map of undefined.</p>