geeklearningio / gl-vsts-tasks-yarn

Yarn Package Manager Visual Studio Team Services Build and Release Management extensions
MIT License
52 stars 18 forks source link

Unexpected token < in JSON at position 0 #91

Closed ecraig12345 closed 2 years ago

ecraig12345 commented 3 years ago

Are you reporting a bug or a feature request ?

Description

YarnInstaller intermittently fails with ##[error]Unexpected token < in JSON at position 0

Example build with failure

The failure is not at all consistent, but it seems to disappear for weeks at a time and then come back (but still only intermittently).

Expected behavior

The task either succeeds, or fails with a meaningful error.

Reproduction

Task configuration (found in this template file):

  - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3
    displayName: 'Use Yarn 1.19.x'
    inputs:
      versionSpec: 1.19.x
      checkLatest: true
      includePrerelease: false

Overall pipeline yaml

Pipeline in ADO

Unfortunately, the failure is infrequent/random enough that we'd have to leave System.Debug enabled for a few hours or days, which is probably not feasible.

My guess is that the culprit is these lines, and that the server at https://publicblobs.geeklearning.io/yarn/tarballsV2.json is occasionally returning an HTML error page which obviously can't be parsed as JSON. https://github.com/geeklearningio/gl-vsts-tasks-yarn/blob/35fe5acf94d51c414c3395bd633805e65093e711/Tasks/YarnInstaller/yarnToolInstallerTask.ts#L13-L18

System information

VSTS or TFS:

Agent:

OS:

Yarn version: 1.19.x

Node version: 12.18.4

sandorfr commented 2 years ago

see #103