Uncaught TypeError: Cannot read property '1' of null?

Uncaught TypeError: Cannot read property '1' of null?

我遇到错误:Uncaught TypeError: Cannot read property '1' of null。这是什么意思?错误的来源是 id: file.meta['key'].match(/^cache\/(.+)/)[1]:

uppy.on('upload-success', (file, response) => {
 // construct uploaded file data in the format that Shrine expects
 const uploadedFileData = {
  id: file.meta['key'].match(/^cache\/(.+)/)[1], // object key without prefix
  storage: 'cache',
  metadata: {
   size: file.size,
   filename: file.name,
   mime_type: file.type,
  }
 }

 // set hidden field value to the uploaded file data so that it's submitted
 // with the form as the attachment
 hiddenInput.value = JSON.stringify(uploadedFileData)
})

我认为这是在尝试 select 索引中不存在的内容,但是……什么索引确实存在?

问题是 id: file.meta['key'].match(/^cache\/(.+)/)[1]Shrine.storage 中的前缀不匹配。我的前缀是 uploads/cache。我只需要将它改回 cache.