Sp-dev-docs: Property 'beginBatch' does not exist on type 'SPHttpClient' Spfx 1.7

Created on 11 Apr 2019  路  8Comments  路  Source: SharePoint/sp-dev-docs

Category

  • [x ] Question
  • [ ] Typo
  • [ x] Bug
  • [ ] Additional article idea

Expected or Desired Behavior

Would like to make batch requests using spHttpClient.

Observed Behavior

I'm using spfx 1.7.0 and is spHttpClient.beginBatch still in preview ? (Error: Property 'beginBatch' does not exist on type 'SPHttpClient'). What is the recommended way to do batching in spfx.

Needs Reproduce Steps spfx-general duplicate

Most helpful comment

I believe batching went GA with SPFx 1.8.0

For 1.7 and 1.7.1 it should still be in preview and available under --plusbeta

More details here: https://github.com/SharePoint/sp-dev-docs/issues/2540

All 8 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

It's a method, not a property. I just tested a project and it built fine (_SPFx 1.7, 1.7.1 & 1.8_) with the following code (lots of code omitted in the following snippet). Please provide a repo if it's not working:

// start a batch request
const batchClient: SPHttpClientBatch = this.contest.spHttpClient.beginBatch();

// create the things to do in the batch
const batchSteps: Promise<IMissionListItem | IMissionListItem[]>[] = [
  this._createMissionAsBatch(batchClient, missionToCreate),
  this._getMissionsAsBatch(batchClient)
];

batchClient.execute()
  .then(() => {
    return Promise.all(batchSteps);
  })
  .then((values: any) => {
    resolve(values[values.length - 1]);
  })
  .catch((error: any) => {
    reject(error);
  });

I believe batching went GA with SPFx 1.8.0

For 1.7 and 1.7.1 it should still be in preview and available under --plusbeta

More details here: https://github.com/SharePoint/sp-dev-docs/issues/2540

Thanks @vman

@vman @andrewconnell : I upgraded my spfx to 1.8.1 and I do have the same issue i.e. /@microsoft/sp-http/dist/index-internal"' has no exported member 'SPHttpClientBatch'.

Can you please confirm if this actually went GA with SPFx 1.8.0 ?

Thanks !

I can confirm that SPHttpClientBatch is not available without the --plusbeta flag in 1.8.1. So I think it is one of two things:

1) Either it was never GA and available without --plusbeta in 1.8.0 because of a bug
2) It is GA and the fact that it is not available in 1.8.1 is a bug

Yup... known issue. There were some build issues in 1.8.0 & 1.8.1... see #3826 and the issues referenced within it to see everything affected.

Specific to batch, the beta flag was accidentally removed in 1.8.0. It should still be beta and require --plusbeta

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

Was this page helpful?
0 / 5 - 0 ratings