Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

190
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda