matfin/meteor-contentful

Getting 'Can't connect to endpoint' error using this package

Closed this issue · 4 comments

W20150724-10:26:55.049(-4)? (STDERR) [Q] Unhandled promise rejection: { status: 'error',
W20150724-10:26:55.049(-4)? (STDERR)   message: 'Could not connect to the endpoint',
W20150724-10:26:55.049(-4)? (STDERR)   data: 
W20150724-10:26:55.049(-4)? (STDERR)    { [Error: failed [401] {   "sys": {     "type": "Error",     "id": "AccessTokenInvalid"   },   "message": "An access token is required. Please send one through the HTTP Authorization header or as the query parameter \"access_token\".",   "requestId": "9f3-527092255" } ]
W20150724-10:26:55.049(-4)? (STDERR)      response: 
W20150724-10:26:55.050(-4)? (STDERR)       { statusCode: 401,
W20150724-10:26:55.050(-4)? (STDERR)         content: '{\n  "sys": {\n    "type": "Error",\n    "id": "AccessTokenInvalid"\n  },\n  "message": "An access token is required. Please send one through the HTTP Authorization header or as the query parameter \\"access_token\\".",\n  "requestId": "9f3-527092255"\n}\n',
W20150724-10:26:55.050(-4)? (STDERR)         headers: [Object],
W20150724-10:26:55.050(-4)? (STDERR)         data: null } } }
W20150724-10:26:55.051(-4)? (STDERR) [Q] Unhandled promise rejection: { status: 'error',
W20150724-10:26:55.051(-4)? (STDERR)   message: 'Could not connect to the endpoint',
W20150724-10:26:55.051(-4)? (STDERR)   data: 
W20150724-10:26:55.051(-4)? (STDERR)    { [Error: failed [401] {   "sys": {     "type": "Error",     "id": "AccessTokenInvalid"   },   "message": "An access token is required. Please send one through the HTTP Authorization header or as the query parameter \"access_token\".",   "requestId": "9f3-527092255" } ]
W20150724-10:26:55.051(-4)? (STDERR)      response: 
W20150724-10:26:55.051(-4)? (STDERR)       { statusCode: 401,
W20150724-10:26:55.052(-4)? (STDERR)         content: '{\n  "sys": {\n    "type": "Error",\n    "id": "AccessTokenInvalid"\n  },\n  "message": "An access token is required. Please send one through the HTTP Authorization header or as the query parameter \\"access_token\\".",\n  "requestId": "9f3-527092255"\n}\n',
W20150724-10:26:55.052(-4)? (STDERR)         headers: [Object],
W20150724-10:26:55.052(-4)? (STDERR)         data: null } } }

All I did was run meteor create app and added settings.json with the correct values and the sample app.js included in the README.

Hi,

It looks like I had specified the following in the settings file, and left in a single quote at the beginning and the end of the value:

"authorisationHeader": "'Bearer 123456789DDDeieiieiei390939'",

They're quite hard to see. Could you make sure they are removed from your settings file and try again and if that still doesn't work, could you paste in your settings file, omitting any sensitive details.

Thanks

Hello,

Okay I removed the single quotes and now getting this:

I20150724-11:43:59.150(-4)? Meteor npmRequire not recognised. Aborting.
I20150724-11:43:59.150(-4)? Ignoring duplicate publish named 'cf_assets'
I20150724-11:43:59.151(-4)? Ignoring duplicate publish named 'cover_images'
I20150724-11:43:59.151(-4)? Meteor npmRequire not recognised. Aborting.
I20150724-11:43:59.151(-4)? Ignoring duplicate publish named 'cf_assets'
I20150724-11:43:59.151(-4)? Ignoring duplicate publish named 'cover_images'
I20150724-11:43:59.151(-4)? Meteor npmRequire not recognised. Aborting.
W20150724-11:43:59.153(-4)? (STDERR) [Q] Unhandled promise rejection: TypeError: Cannot call method 'fail' of undefined
W20150724-11:43:59.153(-4)? (STDERR)     at app/index.js:59:10
W20150724-11:43:59.153(-4)? (STDERR)     at _fulfilled (packages/aramk:q/q.js:787:1)
W20150724-11:43:59.154(-4)? (STDERR)     at self.promiseDispatch.done (packages/aramk:q/q.js:816:1)
W20150724-11:43:59.154(-4)? (STDERR)     at Promise.promise.promiseDispatch (packages/aramk:q/q.js:749:1)
W20150724-11:43:59.154(-4)? (STDERR)     at packages/aramk:q/q.js:557:1
W20150724-11:43:59.154(-4)? (STDERR)     at flush (packages/aramk:q/q.js:108:1)
W20150724-11:43:59.154(-4)? (STDERR)     at process._tickCallback (node.js:442:13)

Here's my repo with settings.json: https://github.com/PHRESHR/meteor-contentful-example

Thanks

Hi,

I had a look through your example and noticed an issue in index.js on line 59 - which gives rise to the Unhandled promise rejection seen above and made a comment on that.

You will also need include a file called packages.json in the root of your directory with the following contents:

{
    "connect":      "3.3.4",
    "body-parser":  "1.10.2",
    "gm":           "1.17.0"
}

For some reason, the meteorhacks:npm package was not installed for you even though I added it as a dependency to this package.

You will need to install it again:

$ meteor install meteorhacks:npm@1.3.0

You must also make sure that if you have added images in Contentful, that the description field for the asset is the same as the imageType in settings.json. This is so that when an image comes in from Contentful and is about to be processed, we know what size it needs to be set to.

Matt

Hi @drejohnson were you able to resolve your issue ? I will close this one for now and if it's still recurring I can take a look.