ZenVoich / mops

Package manager for the Motoko programming language
https://mops.one
MIT License
35 stars 3 forks source link

Mops starts failing after mops Update #207

Closed skilesare closed 2 months ago

skilesare commented 5 months ago

mops --version CLI 0.39.2 API 1.2

If my mops file has a github URL with no hash, no problem:

ie map9 = "https://github.com/ZhenyaUsenko/motoko-hash-map#v9.0.1"

Once I run mops update and get a hash at the end I start getting errors:

map9 = "https://github.com/ZhenyaUsenko/motoko-hash-map#v9.0.1@10b68f6ea8df5e72dfa4c07a50c8bb60a916c233"

If I run mops sources by it self, things seem to work. If mops sources is run as part of a postinstall via npm I get the below error:

/node_modules/got/dist/source/core/index.js:783:23)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:525:35)
    at HTTPParser.parserOnIncomingClient (node:_http_client:693:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
    at TLSSocket.socketOnData (node:_http_client:534:22)
    at TLSSocket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:315:12) {
  input: undefined,
  code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1706724036195,
    socket: 1706724036195,
    lookup: 1706724036196,
    connect: 1706724036239,
    secureConnect: 1706724036287,
    upload: 1706724036287,
    response: 1706724036333,
    end: 1706724036335,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 0,
      dns: 1,
      tcp: 43,
      tls: 48,
      request: 0,
      firstByte: 46,
      download: 2,
      total: 140
    }
  },
  options: Options {
    _unixOptions: undefined,
    _internals: {
      request: undefined,
      agent: { http: undefined, https: undefined, http2: undefined },
      h2session: undefined,
      decompress: true,
      timeout: {
        connect: undefined,
        lookup: undefined,
        read: undefined,
        request: undefined,
        response: undefined,
        secureConnect: undefined,
        send: undefined,
        socket: undefined
      },
      prefixUrl: '',
      body: undefined,
      form: undefined,
      json: undefined,
      cookieJar: undefined,
      ignoreInvalidCookies: false,
      searchParams: undefined,
      dnsLookup: undefined,
      dnsCache: undefined,
      context: {},
      hooks: {
        init: [],
        beforeRequest: [],
        beforeError: [],
        beforeRedirect: [],
        beforeRetry: [],
        afterResponse: []
      },
      followRedirect: true,
      maxRedirects: 10,
      cache: undefined,
      throwHttpErrors: true,
      username: '',
      password: '',
      http2: false,
      allowGetBody: false,
      headers: {
        'user-agent': 'got (https://github.com/sindresorhus/got)',
        'accept-encoding': 'gzip, deflate, br'
      },
      methodRewriting: false,
      dnsLookupIpVersion: undefined,
      parseJson: [Function: parse],
      stringifyJson: [Function: stringify],
      retry: {
        limit: 2,
        methods: [ 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' ],
        statusCodes: [
          408, 413, 429, 500,
          502, 503, 504, 521,
          522, 524
        ],
        errorCodes: [
          'ETIMEDOUT',
          'ECONNRESET',
          'EADDRINUSE',
          'ECONNREFUSED',
          'EPIPE',
          'ENOTFOUND',
          'ENETUNREACH',
          'EAI_AGAIN'
        ],
        maxRetryAfter: undefined,
        calculateDelay: [Function: calculateDelay],
        backoffLimit: Infinity,
        noise: 100
      },
      localAddress: undefined,
      method: 'GET',
      createConnection: undefined,
      cacheOptions: {
        shared: undefined,
        cacheHeuristic: undefined,
        immutableMinTimeToLive: undefined,
        ignoreCargoCult: undefined
      },
      https: {
        alpnProtocols: undefined,
        rejectUnauthorized: undefined,
        checkServerIdentity: undefined,
        certificateAuthority: undefined,
        key: undefined,
        certificate: undefined,
        passphrase: undefined,
        pfx: undefined,
        ciphers: undefined,
        honorCipherOrder: undefined,
        minVersion: undefined,
        maxVersion: undefined,
        signatureAlgorithms: undefined,
        tlsSessionLifetime: undefined,
        dhparam: undefined,
        ecdhCurve: undefined,
        certificateRevocationLists: undefined
      },
      encoding: undefined,
      resolveBodyOnly: false,
      isStream: true,
      responseType: 'text',
      url: <ref *1> URL {
        [Symbol(context)]: URLContext {
          flags: 400,
          scheme: 'https:',
          username: '',
          password: '',
          host: 'codeload.github.com',
          port: null,
          path: [
            'ZhenyaUsenko',
            'motoko-hash-map',
            'zip',
            'v9.0.1%4010b68f6ea8df5e72dfa4c07a50c8bb60a916c233'
          ],
          query: null,
          fragment: null
        },
        [Symbol(query)]: URLSearchParams {
          [Symbol(query)]: [],
          [Symbol(context)]: [Circular *1]
        }
      },
      pagination: {
        transform: [Function: transform],
        paginate: [Function: paginate],
        filter: [Function: filter],
        shouldContinue: [Function: shouldContinue],
        countLimit: Infinity,
        backoff: 0,
        requestLimit: 10000,
        stackAllItems: false
      },
      setHost: true,
      maxHeaderSize: undefined,
      signal: undefined,
      enableUnixSockets: true
    },
    _merging: false,
    _init: [ { isStream: true } ]
  }
}
ZenVoich commented 5 months ago

Hi @skilesare

I tried to reproduce this with mops.toml:

[dependencies]
map9 = "https://github.com/ZhenyaUsenko/motoko-hash-map#v9.0.1@10b68f6ea8df5e72dfa4c07a50c8bb60a916c233"

and package.json

{
    "scripts": {
        "postinstall": "mops sources"
    }
}

and when I run npm install I get no errors.

Could you provide a full mops.toml file that I can play with?

skilesare commented 5 months ago

Pretty simple:

[dependencies] base = "0.10.4" map9 = "https://github.com/ZhenyaUsenko/motoko-hash-map#v9.0.1" account = "1.0.1"

I'm using this as the starter project which may be helpful because I only ever see these when trying to run the vite dev server or some other npm command: https://github.com/rvanasa/vite-react-motoko cc @rvanasa

And now today randomly I'm getting this:

The build step failed for canister 'br5f7-7uaaa-aaaaa-qaaca-cai' (backend) with an embedded error: Failed to build Motoko canister 'backend'.: Failed to load package arguments.: The command '"mops" "sources"' failed with exit status 'exit status: 1'. Stdout:

Stderr: node:internal/process/promises:279 triggerUncaughtException(err, true / fromPromise /); ^

HTTPError: Response code 404 (Not Found) at Request._onResponseBase (file:///cycles-ledger-integration-poc/node_modules/got/dist/source/core/index.js:706:31) at Request._onResponse (file:///cycles-ledger-integration-poc/node_modules/got/dist/source/core/index.js:765:24) at ClientRequest. (file:///cycles-ledger-integration-poc/node_modules/got/dist/source/core/index.js:783:23) at Object.onceWrapper (node:events:628:26) at ClientRequest.emit (node:events:525:35) at HTTPParser.parserOnIncomingClient (node:_http_client:693:27) at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17) at TLSSocket.socketOnData (node:_http_client:534:22) at TLSSocket.emit (node:events:513:28) at addChunk (node:internal/streams/readable:315:12) { input: undefined, code: 'ERR_NON_2XX_3XX_RESPONSE', timings: { start: 1706824467479, socket: 1706824467479, lookup: 1706824467503, connect: 1706824467546, secureConnect: 1706824467591, upload: 1706824467591, response: 1706824467679, end: 1706824467681, error: undefined, abort: undefined, phases: { wait: 0, dns: 24, tcp: 43, tls: 45, request: 0, firstByte: 88, download: 2, total: 202 } }, options: Options { _unixOptions: undefined, _internals: { request: undefined, agent: { http: undefined, https: undefined, http2: undefined }, h2session: undefined, decompress: true, timeout: { connect: undefined, lookup: undefined, read: undefined, request: undefined, response: undefined, secureConnect: undefined, send: undefined, socket: undefined }, prefixUrl: '', body: undefined, form: undefined, json: undefined, cookieJar: undefined, ignoreInvalidCookies: false, searchParams: undefined, dnsLookup: undefined, dnsCache: undefined, context: {}, hooks: { init: [], beforeRequest: [], beforeError: [], beforeRedirect: [], beforeRetry: [], afterResponse: [] }, followRedirect: true, maxRedirects: 10, cache: undefined, throwHttpErrors: true, username: '', password: '', http2: false, allowGetBody: false, headers: { 'user-agent': 'got (https://github.com/sindresorhus/got)', 'accept-encoding': 'gzip, deflate, br' }, methodRewriting: false, dnsLookupIpVersion: undefined, parseJson: [Function: parse], stringifyJson: [Function: stringify], retry: { limit: 2, methods: [ 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' ], statusCodes: [ 408, 413, 429, 500, 502, 503, 504, 521, 522, 524 ], errorCodes: [ 'ETIMEDOUT', 'ECONNRESET', 'EADDRINUSE', 'ECONNREFUSED', 'EPIPE', 'ENOTFOUND', 'ENETUNREACH', 'EAI_AGAIN' ], maxRetryAfter: undefined, calculateDelay: [Function: calculateDelay], backoffLimit: Infinity, noise: 100 }, localAddress: undefined, method: 'GET', createConnection: undefined, cacheOptions: { shared: undefined, cacheHeuristic: undefined, immutableMinTimeToLive: undefined, ignoreCargoCult: undefined }, https: { alpnProtocols: undefined, rejectUnauthorized: undefined, checkServerIdentity: undefined, certificateAuthority: undefined, key: undefined, certificate: undefined, passphrase: undefined, pfx: undefined, ciphers: undefined, honorCipherOrder: undefined, minVersion: undefined, maxVersion: undefined, signatureAlgorithms: undefined, tlsSessionLifetime: undefined, dhparam: undefined, ecdhCurve: undefined, certificateRevocationLists: undefined }, encoding: undefined, resolveBodyOnly: false, isStream: true, responseType: 'text', url: <ref *1> URL { [Symbol(context)]: URLContext { flags: 400, scheme: 'https:', username: '', password: '', host: 'codeload.github.com', port: null, path: [ 'aviate-labs', 'array.mo', 'zip', 'v0.2.0%40863a668bcbb3c3799a62c36b2cba2c32d1fcc433' ], query: null, fragment: null }, Symbol(query): URLSearchParams {

      [Symbol(context)]: [Circular *1]
    }
  },
  pagination: {
    transform: [Function: transform],
    paginate: [Function: paginate],
    filter: [Function: filter],
    shouldContinue: [Function: shouldContinue],
    countLimit: Infinity,
    backoff: 0,
    requestLimit: 10000,
    stackAllItems: false
  },
  setHost: true,
  maxHeaderSize: undefined,
  signal: undefined,
  enableUnixSockets: true
},
_merging: false,
_init: [ { isStream: true } ]

} }

ZenVoich commented 5 months ago

Got it, there is too old local ic-mops npm dependency that does not support new #<branch>@<hash> syntax

Replacing "ic-mops": "^0.17.2", with "ic-mops": "^0.39.2", should work