runner icon indicating copy to clipboard operation
runner copied to clipboard

StdError [HttpError]: Response code 403 (Forbidden)

Open benpetty opened this issue 5 years ago • 14 comments

Everything has been working fine until recently getting this 403 response when trying to start mongodb-runner

~ ❯ mongodb-runner start
  ◜ Starting a MongoDB deployment to test against...StdError [HTTPError]: Response code 403 (Forbidden)
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/mongodb-runner/node_modules/got/index.js:250:24)
    at EventEmitter.emit (events.js:209:13)
    at Immediate.<anonymous> (/usr/local/lib/node_modules/mongodb-runner/node_modules/got/index.js:99:8)
    at processImmediate (internal/timers.js:439:21) {
  name: 'HTTPError',
  host: 'fastdl.mongodb.org',
  hostname: 'fastdl.mongodb.org',
  method: 'GET',
  path: '/osx/mongodb-macos-x86_64-4.2.4.tgz',
  protocol: 'https:',
  url: 'https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.4.tgz',
  statusCode: 403,
  statusMessage: 'Forbidden',
  headers: {
    'content-type': 'application/xml',
    'transfer-encoding': 'chunked',
    connection: 'close',
    date: 'Sat, 14 Mar 2020 21:42:25 GMT',
    server: 'AmazonS3',
    'x-cache': 'Error from cloudfront',
    via: '1.1 6a9b42e38e76b7d4a4044ebe0e0eca09.cloudfront.net (CloudFront)',
    'x-amz-cf-pop': 'SEA19-C2',
    'x-amz-cf-id': 'RS3OleoocqZ9Ltp6ZAmLHKUPKRiWbvC3tLdQuQYfXZyCXYky86MrMg=='
  }
}
StdError [HTTPError]: Response code 403 (Forbidden)
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/mongodb-runner/node_modules/got/index.js:250:24)
    at EventEmitter.emit (events.js:209:13)
    at Immediate.<anonymous> (/usr/local/lib/node_modules/mongodb-runner/node_modules/got/index.js:99:8)
    at processImmediate (internal/timers.js:439:21) {
  name: 'HTTPError',
  host: 'fastdl.mongodb.org',
  hostname: 'fastdl.mongodb.org',
  method: 'GET',
  path: '/osx/mongodb-macos-x86_64-4.2.4.tgz',
  protocol: 'https:',
  url: 'https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.4.tgz',
  statusCode: 403,
  statusMessage: 'Forbidden',
  headers: {
    'content-type': 'application/xml',
    'transfer-encoding': 'chunked',
    connection: 'close',
    date: 'Sat, 14 Mar 2020 21:42:25 GMT',
    server: 'AmazonS3',
    'x-cache': 'Error from cloudfront',
    via: '1.1 6a9b42e38e76b7d4a4044ebe0e0eca09.cloudfront.net (CloudFront)',
    'x-amz-cf-pop': 'SEA19-C2',
    'x-amz-cf-id': 'RS3OleoocqZ9Ltp6ZAmLHKUPKRiWbvC3tLdQuQYfXZyCXYky86MrMg=='
  }
}

benpetty avatar Mar 14 '20 21:03 benpetty

Temp workaround is setting MONGODB_VERSION=4.2.3

MongoDB download page (https://www.mongodb.com/download-center/community) shows latest release is 4.2.3 so not sure where 4.2.4 is coming from

benpetty avatar Mar 14 '20 22:03 benpetty

This is also happening to other versions.

StdError [HTTPError]: Response code 403 (Forbidden)
    at EventEmitter.<anonymous> (/home/vsonline/.npm-global/lib/node_modules/mongodb-runner/node_modules/got/index.js:250:24)
    at EventEmitter.emit (events.js:210:5)
    at Immediate.<anonymous> (/home/vsonline/.npm-global/lib/node_modules/mongodb-runner/node_modules/got/index.js:99:8)
    at processImmediate (internal/timers.js:439:21) {
  name: 'HTTPError',
  host: 'fastdl.mongodb.org',
  hostname: 'fastdl.mongodb.org',
  method: 'GET',
  path: '/linux/mongodb-linux-x86_64-4.2.8.tgz',
  protocol: 'https:',
  url: 'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.2.8.tgz',
  statusCode: 403,
  statusMessage: 'Forbidden',
  headers: {
    'content-type': 'application/xml',
    'transfer-encoding': 'chunked',
    connection: 'close',
    date: 'Tue, 30 Jun 2020 21:13:56 GMT',
    server: 'AmazonS3',
    'x-cache': 'Error from cloudfront',
    via: '1.1 987c00b911316df568db602f83876a8e.cloudfront.net (CloudFront)',
    'x-amz-cf-pop': 'DUS51-C1',
    'x-amz-cf-id': 'G50IaYpMFB44EB_8_xljslGGC2qGf7gFeo2vQIY-heSPFb59gTUrCA=='
  }
}

rhuanbarreto avatar Jun 30 '20 21:06 rhuanbarreto

mongodb url changed:

new: https://fastdl.mongodb.org/src/mongodb-src-r4.2.8.tar.gz old: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.2.8.tgz << This is not working

DevDorrejo avatar Jul 11 '20 04:07 DevDorrejo

mongodb url changed:

new: https://fastdl.mongodb.org/src/mongodb-src-r4.2.8.tar.gz old: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.2.8.tgz << This is not working

Could you please tell me how to modify the "old" link to the "new" link? Thank you so much.

myfirst-crypto avatar Aug 17 '20 12:08 myfirst-crypto

I ended up hardcoding in the new URL at line 306 image This seems to at least download the file, however now I get a new error

~: mongodb-runner start
  ◡ Starting a MongoDB deployment to test against...✔  Downloaded MongoDB 4.4.1
  ◞ Starting a MongoDB deployment to test against...internal/fs/utils.js:714
  throw new ERR_INVALID_ARG_TYPE(
  ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (25320)
    at writeFile (fs.js:1386:5)
    at go$writeFile (/usr/lib/node_modules/mongodb-runner/node_modules/graceful-fs/graceful-fs.js:139:14)
    at Object.writeFile (/usr/lib/node_modules/mongodb-runner/node_modules/graceful-fs/graceful-fs.js:136:12)
    at Object.writeFile (/usr/lib/node_modules/mongodb-runner/node_modules/universalify/index.js:5:67)
    at /usr/lib/node_modules/mongodb-runner/lib/index.js:240:12
    at nextTask (/usr/lib/node_modules/mongodb-runner/node_modules/async/dist/async.js:4576:27)
    at next (/usr/lib/node_modules/mongodb-runner/node_modules/async/dist/async.js:4584:13)
    at /usr/lib/node_modules/mongodb-runner/node_modules/async/dist/async.js:321:20
    at /usr/lib/node_modules/mongodb-runner/lib/index.js:235:11
    at getPIDPath (/usr/lib/node_modules/mongodb-runner/lib/index.js:22:3) {
  code: 'ERR_INVALID_ARG_TYPE'
}

So I do think this issue needs to be properly resolved

iommu avatar Oct 05 '20 00:10 iommu

Running into this as well for 4.4.1.

I'm thinking this is the new URL: https://fastdl.mongodb.org/src/mongodb-src-r4.4.1.tar.gz

mongodb-runner start
  ◜ Starting a MongoDB deployment to test against...StdError [HTTPError]: Response code 403 (Forbidden)
    at EventEmitter.<anonymous> (/home/username/.nvm/versions/node/v14.11.0/lib/node_modules/mongodb-runner/node_modules/got/index.js:250:24)
    at EventEmitter.emit (events.js:314:20)
    at Immediate.<anonymous> (/home/username/.nvm/versions/node/v14.11.0/lib/node_modules/mongodb-runner/node_modules/got/index.js:99:8)
    at processImmediate (internal/timers.js:461:21) {
  host: 'fastdl.mongodb.org',
  hostname: 'fastdl.mongodb.org',
  method: 'GET',
  path: '/linux/mongodb-linux-x86_64-4.4.1.tgz',
  protocol: 'https:',
  url: 'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.4.1.tgz',
  statusCode: 403,
  statusMessage: 'Forbidden',
  headers: {
    'content-type': 'application/xml',
    'transfer-encoding': 'chunked',
    connection: 'close',
    date: 'Wed, 11 Nov 2020 06:16:27 GMT',
    server: 'AmazonS3',
    'x-cache': 'Error from cloudfront',
    via: '1.1 91eda795c3265b7a81caba456f5e9dd8.cloudfront.net (CloudFront)',
    'x-amz-cf-pop': 'SFO20-C1',
    'x-amz-cf-id': 'cZipXkhHB4MVF9uX6jWtGPXDzIR_ocmwWMceE-Oo5LYEpMblB6u0Jg=='
  }
}
StdError [HTTPError]: Response code 403 (Forbidden)
    at EventEmitter.<anonymous> (/home/username/.nvm/versions/node/v14.11.0/lib/node_modules/mongodb-runner/node_modules/got/index.js:250:24)
    at EventEmitter.emit (events.js:314:20)
    at Immediate.<anonymous> (/home/username/.nvm/versions/node/v14.11.0/lib/node_modules/mongodb-runner/node_modules/got/index.js:99:8)
    at processImmediate (internal/timers.js:461:21) {
  host: 'fastdl.mongodb.org',
  hostname: 'fastdl.mongodb.org',
  method: 'GET',
  path: '/linux/mongodb-linux-x86_64-4.4.1.tgz',
  protocol: 'https:',
  url: 'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.4.1.tgz',
  statusCode: 403,
  statusMessage: 'Forbidden',
  headers: {
    'content-type': 'application/xml',
    'transfer-encoding': 'chunked',
    connection: 'close',
    date: 'Wed, 11 Nov 2020 06:16:27 GMT',
    server: 'AmazonS3',
    'x-cache': 'Error from cloudfront',
    via: '1.1 91eda795c3265b7a81caba456f5e9dd8.cloudfront.net (CloudFront)',
    'x-amz-cf-pop': 'SFO20-C1',
    'x-amz-cf-id': 'cZipXkhHB4MVF9uX6jWtGPXDzIR_ocmwWMceE-Oo5LYEpMblB6u0Jg=='
  }
}

Hardcoding the URL I get the same error as @iommu

/home/username/.nvm/versions/node/v14.11.0/lib/node_modules/mongodb-runner/node_modules/mongodb-download-url/index.js - around line 305

Natetronn avatar Nov 11 '20 06:11 Natetronn

@iommu URL fix may be working in and of itself, however, the subsequent error may be related to Node version, at least according to this issue: https://github.com/mongodb-js/runner/issues/177

I'm on v14.11.0

Natetronn avatar Nov 11 '20 07:11 Natetronn

the following command is working for me

MONGODB_VERSION=4.0.15 npx mongodb-runner start

callmephilip avatar Nov 11 '20 17:11 callmephilip

the following command is working for me

MONGODB_VERSION=4.0.15 npx mongodb-runner start

Unfortunately, that didn't work for me.

What version of Node are you running? node -v

Natetronn avatar Nov 11 '20 18:11 Natetronn

I think I may have got it working; ~~I'm not 100% sure, as I've never used Parse and haven't tested any further than this, however.~~ "Saving your first object" worked and I'm running Parse Dashboard etc.

After hard coding the v4.4.1 URL, as mentioned above by @iommu and myself, in mongodb-runner/node_modules/mongodb-download-url/index.js, around line 305:

//opts.url = format('https://%s/%s/%s', hostname, opts.platform, artifact);
opts.url = "https://fastdl.mongodb.org/src/mongodb-src-r4.4.1.tar.gz";

You'll then need to edit mongodb-runner/lib/index.js

Line 235 or 236, change: cb(null, pid, pidPath); to: cb(null, pid.toString(), pidPath);

Note: I'm running nvm, as such the above paths may be different for you. Find your own mongodb-runner/lib/index.js, where ever your mongodb-runner and its node_modules live.

This is the output:


❯ npx mongodb-runner start
  ◠ Starting a MongoDB deployment to test against...✔  Downloaded MongoDB 4.4.1
  ◞ Starting a MongoDB deployment to test against...%                                                                                                                                       

❯ npm start

> parse@ start /home/username/Code/parse
> parse-server config.json

Configuration loaded from /home/username/Code/parse/config.json
allowClientClassCreation: true
appId: ***REDACTED***
appName: Parse
cacheMaxSize: 10000
cacheTTL: 5000
cloud: ./cloud/main
customPages: {}
databaseURI: mongodb://127.0.0.1:27017/parse
enableAnonymousUsers: true
expireInactiveSessions: true
graphQLPath: /graphql
host: 0.0.0.0
idempotencyOptions: {"ttl":300,"paths":[]}
logsFolder: ./logs
masterKey: ***REDACTED***
masterKeyIps: []
maxUploadSize: 20mb
mountPath: /parse
objectIdSize: 10
playgroundPath: /playground
port: 1337
protectedFields: {"_User":{"*":["email"]}}
revokeSessionOnPasswordReset: true
schemaCacheTTL: 5000
sessionLength: 31536000
allowCustomObjectId: false
collectionPrefix: 
directAccess: false
enableExpressErrorHandler: false
enableSingleSchemaCache: false
mountGraphQL: false
mountPlayground: false
preserveFileName: false
preventLoginWithUnverifiedEmail: false
scheduledPush: false
verifyUserEmails: false
jsonLogs: false
verbose: false
level: undefined
serverURL: http://localhost:1337/parse

[140115] parse-server running on http://localhost:1337/parse

Natetronn avatar Nov 12 '20 06:11 Natetronn

@Natetronn i am running node v10.19.0

callmephilip avatar Nov 12 '20 10:11 callmephilip

i am running node v10.19.0

Thanks, I figured as much. Yeah, this second issue that iommu and I were hitting is related to v14.x.x.

I believe my fix above addressed it.

Natetronn avatar Nov 12 '20 16:11 Natetronn

Running into this as well for 4.4.1.

I'm thinking this is the new URL: https://fastdl.mongodb.org/src/mongodb-src-r4.4.1.tar.gz

mongodb-runner start
  ◜ Starting a MongoDB deployment to test against...StdError [HTTPError]: Response code 403 (Forbidden)
    at EventEmitter.<anonymous> (/home/username/.nvm/versions/node/v14.11.0/lib/node_modules/mongodb-runner/node_modules/got/index.js:250:24)
    at EventEmitter.emit (events.js:314:20)
    at Immediate.<anonymous> (/home/username/.nvm/versions/node/v14.11.0/lib/node_modules/mongodb-runner/node_modules/got/index.js:99:8)
    at processImmediate (internal/timers.js:461:21) {
  host: 'fastdl.mongodb.org',
  hostname: 'fastdl.mongodb.org',
  method: 'GET',
  path: '/linux/mongodb-linux-x86_64-4.4.1.tgz',
  protocol: 'https:',
  url: 'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.4.1.tgz',
  statusCode: 403,
  statusMessage: 'Forbidden',
  headers: {
    'content-type': 'application/xml',
    'transfer-encoding': 'chunked',
    connection: 'close',
    date: 'Wed, 11 Nov 2020 06:16:27 GMT',
    server: 'AmazonS3',
    'x-cache': 'Error from cloudfront',
    via: '1.1 91eda795c3265b7a81caba456f5e9dd8.cloudfront.net (CloudFront)',
    'x-amz-cf-pop': 'SFO20-C1',
    'x-amz-cf-id': 'cZipXkhHB4MVF9uX6jWtGPXDzIR_ocmwWMceE-Oo5LYEpMblB6u0Jg=='
  }
}
StdError [HTTPError]: Response code 403 (Forbidden)
    at EventEmitter.<anonymous> (/home/username/.nvm/versions/node/v14.11.0/lib/node_modules/mongodb-runner/node_modules/got/index.js:250:24)
    at EventEmitter.emit (events.js:314:20)
    at Immediate.<anonymous> (/home/username/.nvm/versions/node/v14.11.0/lib/node_modules/mongodb-runner/node_modules/got/index.js:99:8)
    at processImmediate (internal/timers.js:461:21) {
  host: 'fastdl.mongodb.org',
  hostname: 'fastdl.mongodb.org',
  method: 'GET',
  path: '/linux/mongodb-linux-x86_64-4.4.1.tgz',
  protocol: 'https:',
  url: 'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.4.1.tgz',
  statusCode: 403,
  statusMessage: 'Forbidden',
  headers: {
    'content-type': 'application/xml',
    'transfer-encoding': 'chunked',
    connection: 'close',
    date: 'Wed, 11 Nov 2020 06:16:27 GMT',
    server: 'AmazonS3',
    'x-cache': 'Error from cloudfront',
    via: '1.1 91eda795c3265b7a81caba456f5e9dd8.cloudfront.net (CloudFront)',
    'x-amz-cf-pop': 'SFO20-C1',
    'x-amz-cf-id': 'cZipXkhHB4MVF9uX6jWtGPXDzIR_ocmwWMceE-Oo5LYEpMblB6u0Jg=='
  }
}

Hardcoding the URL I get the same error as @iommu

/home/username/.nvm/versions/node/v14.11.0/lib/node_modules/mongodb-runner/node_modules/mongodb-download-url/index.js - around line 305

thanks man it helped a lot

sandeepkumarmishra354 avatar Jan 04 '21 04:01 sandeepkumarmishra354

I think I may have got it working; ~I'm not 100% sure, as I've never used Parse and haven't tested any further than this, however.~ "Saving your first object" worked and I'm running Parse Dashboard etc.

After hard coding the v4.4.1 URL, as mentioned above by @iommu and myself, in mongodb-runner/node_modules/mongodb-download-url/index.js, around line 305:

//opts.url = format('https://%s/%s/%s', hostname, opts.platform, artifact);
opts.url = "https://fastdl.mongodb.org/src/mongodb-src-r4.4.1.tar.gz";

You'll then need to edit mongodb-runner/lib/index.js

Line 235 or 236, change: cb(null, pid, pidPath); to: cb(null, pid.toString(), pidPath);

Note: I'm running nvm, as such the above paths may be different for you. Find your own mongodb-runner/lib/index.js, where ever your mongodb-runner and its node_modules live.

This is the output:


❯ npx mongodb-runner start
  ◠ Starting a MongoDB deployment to test against...✔  Downloaded MongoDB 4.4.1
  ◞ Starting a MongoDB deployment to test against...%                                                                                                                                       

❯ npm start

> parse@ start /home/username/Code/parse
> parse-server config.json

Configuration loaded from /home/username/Code/parse/config.json
allowClientClassCreation: true
appId: ***REDACTED***
appName: Parse
cacheMaxSize: 10000
cacheTTL: 5000
cloud: ./cloud/main
customPages: {}
databaseURI: mongodb://127.0.0.1:27017/parse
enableAnonymousUsers: true
expireInactiveSessions: true
graphQLPath: /graphql
host: 0.0.0.0
idempotencyOptions: {"ttl":300,"paths":[]}
logsFolder: ./logs
masterKey: ***REDACTED***
masterKeyIps: []
maxUploadSize: 20mb
mountPath: /parse
objectIdSize: 10
playgroundPath: /playground
port: 1337
protectedFields: {"_User":{"*":["email"]}}
revokeSessionOnPasswordReset: true
schemaCacheTTL: 5000
sessionLength: 31536000
allowCustomObjectId: false
collectionPrefix: 
directAccess: false
enableExpressErrorHandler: false
enableSingleSchemaCache: false
mountGraphQL: false
mountPlayground: false
preserveFileName: false
preventLoginWithUnverifiedEmail: false
scheduledPush: false
verifyUserEmails: false
jsonLogs: false
verbose: false
level: undefined
serverURL: http://localhost:1337/parse

[140115] parse-server running on http://localhost:1337/parse

Thanks a lot! This saved me from a lot of more research

fernandodlmf avatar Jan 13 '21 13:01 fernandodlmf