cosmicjs / cosmicjs-node

*API v2 JavaScript client for Cosmic. See important message in README
https://www.cosmicjs.com
MIT License
275 stars 38 forks source link

Potential braking change with the 4.2 version #80

Closed Gustavinho closed 1 year ago

Gustavinho commented 1 year ago

Hello,

I was using 4.1 for almost 2 years ago, and my site started to crash last week, debugging my code I realized we stopped getting some of the nested data as we were expecting, I suppose there was a change in the cosmicjs api, I have a structure of nested objects in cosmic, something like this pages -> sections -> videos, the reason why my site started to crash is because of the data of the last object in my nesting chain was different, I was expecting an object with the whole data, instead of that, I was getting a string with just the id.

Before

{
   // rest of the page data,
  metadata: {
    sections: [
      {
        // rest of the object's metadata,
        video: {
          // whole video's metadata
        }
      }
    ]
  }
}

Before

{
   // rest of the page data,
  metadata: {
    sections: [
      {
        // rest of the object's metadata,
        video: '60d10806dd65e129d4f2870b' // just a single string
      }
    ]
  }
}

I updated the package to the latest version and I kept having this issue, this article says there are no breaking changes https://www.cosmicjs.com/changelog/npm-module-updates-v4-2, however, I had to change the implementation from bucket.getObjects to bucket.objects.find with the new specification, only after that, it worked as before again

tonyspiro commented 1 year ago

@Gustavinho apologies for the issue. Can you please email us so we can get more information regarding your account? support@cosmicjs.com thank you.

tonyspiro commented 1 year ago

Closing this issue @Gustavinho due to inactivity.