bchr02 / node-pre-gyp-github

A node-pre-gyp module which provides the ability to publish to GitHub releases.
MIT License
52 stars 32 forks source link

Bad Request 400 #41

Closed tdewolff closed 2 years ago

tdewolff commented 2 years ago

I'm trying to use this package, but I get

gyp info ok 
node-pre-gyp info ok 
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.9
node-pre-gyp info using node@16.14.2 | linux | x64
packing Release/.deps/Release/minify.node.d
packing Release/.deps/Release/obj.target/minify/minify.o.d
packing Release/.deps/Release/obj.target/minify.node.d
packing Release/minify.node
packing Release/obj.target/minify/minify.o
packing Release/obj.target/minify.node
node-pre-gyp info package Binary staged at "build/stage/0.1.0/minify-v0.1.0-node-v93-linux-x64.tar.gz"
node-pre-gyp info ok 
[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4
DEPRECATED (@octokit/rest): `repos.getReleases()` is deprecated, use `repos.listReleases()`
DEPRECATED (@octokit/rest): callbacks will be removed in v16. Use async/await or Promises instead.
/home/taco/go/src/github.com/tdewolff/minify/bindings/js/node_modules/node-pre-gyp-github/node_modules/@octokit/rest/lib/request/request.js:72
            throw new HttpError(message, status, headers)
                  ^

HttpError: {"message":"Must specify access token via Authorization header. https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param","documentation_url":"https://docs.github.com/v3/#oauth2-token-sent-in-a-header"}
    at /home/taco/go/src/github.com/tdewolff/minify/bindings/js/node_modules/node-pre-gyp-github/node_modules/@octokit/rest/lib/request/request.js:72:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 400,
  status: 'Bad Request',
  headers: {
    'access-control-allow-origin': '*',
    'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
    connection: 'close',
    'content-length': '230',
    'content-security-policy': "default-src 'none'",
    'content-type': 'application/json; charset=utf-8',
    date: 'Tue, 12 Apr 2022 20:56:56 GMT',
    'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
    server: 'GitHub.com',
    'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
    vary: 'Accept-Encoding, Accept, X-Requested-With',
    'x-content-type-options': 'nosniff',
    'x-frame-options': 'deny',
    'x-github-media-type': 'github.v3; format=json',
    'x-github-request-id': 'DB72:7A63:36025C:3B9E0F:6255E798',
    'x-ratelimit-limit': '60',
    'x-ratelimit-remaining': '56',
    'x-ratelimit-reset': '1649799482',
    'x-ratelimit-resource': 'core',
    'x-ratelimit-used': '4',
    'x-xss-protection': '0'
  }
}

which has to do with @octokit/rest. I'm really new to NPM and its versioning and updating policy, for some reason installing npm install node-pre-gyp-github@latest requires @octokit/rest@15.9.5, while it should be @octokit/rest@18.12.0 as seen in the package.json of this repository...

tdewolff commented 2 years ago

Solution was to use this git repository instead of installing this package from the npm.

daniellockyer commented 2 years ago

@tdewolff I'm just about to publish a new version from master 🙂

daniellockyer commented 2 years ago

Published 🙂