🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

JS Client: Promise Polyfill

The Sanity JavaScript client uses Promises to handle asyncronous requests. Some browsers (such as Internet Explorer) does not support this interface by default, and thus requires a so called polyfill for it to work.

There are many polyfills to choose from - we recommend something that comforms to the Promises/A+ specification, such as the es6-promise module. The readme for that module includes various ways to use it - the most important thing to note is that you should make sure the polyfill is applied before the Sanity client is instantiated.

Here's an example if you are using a bundler such as webpack, browserify or parcel:

const sanityClient = require('@sanity/client')

module.exports = sanityClient({
  projectId: '...',
  dataset: '...',
  useCdn: true

(Make sure es6-promise is added as a dependency for your project.)

Was this article helpful?