Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

188
Views
issue when making request to contentful api using NUXT

I have been able to make requests to a contentful API where I have blogs in them. It suddenly stopped working today but I cannot figure out what I changed, or what the issue is. the message I get Cannot read properties of undefined (reading 'file') doesn't make sense because there is an image there.

Beow is the method that gets blogs

        async getAllBlogs(limit = this.limit, skip = 0) {
            var response = await this.$contentful.client.getEntries({
                content_type: 'blog',
                order: 'fields.id',
                limit,
                skip
            })
            let blogs = response.items;

            blogs = blogs.map((item) => {
                const { id, createdAt } = item.sys;
                const { slug, title, description } = item.fields;
                const thumbnail = item.fields.thumbnail.fields.file.url
                return{
                    id, slug, title, thumbnail, description, createdAt
                }
            })
            console.log(blogs);
            return this.blogs = blogs;
        },

But with this i get in my console

index.vue?6ced:58 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'file')
    at eval (index.vue?6ced:58:1)
    at Array.map (<anonymous>)
    at _callee$ (index.vue?6ced:55:1)
    at tryCatch (runtime.js?96cf:63:1)
    at Generator.invoke [as _invoke] (runtime.js?96cf:294:1)
    at Generator.eval [as next] (runtime.js?96cf:119:1)
    at asyncGeneratorStep (asyncToGenerator.js?1da1:3:1)
    at _next (asyncToGenerator.js?1da1:25:1)

Please, what could be the problem?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!