问题
I'm using Vimeo api
for node.js
and now encountered a problem, that never occured before. On attempt to lib.generateClientCredentials
it throws error (and crashes node app):
[Error: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="robots" content="nofollow, noindex">
<title>Sorry. Vimeo will be right back.</title>
<style>
body {
margin: 0;
padding: 0;
background: #34454E url('https://f.vimeocdn.com/images_v6/ins_down_illustr
ation.png') bottom repeat-x fixed;
color: #ffffff;
font: 36px/1.3 Helvetica, Arial, sans-serif;
text-align: center;
}
#content {
position: fixed;
width: 100%;
top: 35px;
left: 0;
}
h1 {
margin-bottom: 35px;
height: 101px;
background: url('https://f.vimeocdn.com/images_v6/ins_down_vimeo.png') cen
ter no-repeat;
text-indent: -1000em;
overflow: hidden;
}
h2 {
color: #717D83;
font-size: 37px;
font-weight: normal;
margin-bottom: 5px;
}
p {
margin: 0;
}
@media all and (min-height: 960px) {
#content {
top: 5%;
}
}
@media all and (min-height: 1200px) {
#content {
top: 10%;
}
}
@media all and (max-height: 900px) {
body {
background-position: center 300px;
}
#content {
top: 0;
}
}
</style>
</head>
<body>
<div id="content">
<h1>Vimeo</h1>
<h2>Something is weird in the magical forest.</h2>
<p>We’ll be back in a jiffy.</p>
</div>
</body>
</html>]
So:
1. Why is it happening?
2. Why HTML being thrown as error in server side api? (to pass it to users I assume?)
Edit:
My Vimeo-API
configuring module (Basicly the same as example in Vimeo
docs):
var Vimeo = require('vimeo-api').Vimeo;
var lib = new Vimeo('*somethingsecret*', '*anothersecretthing*');
lib.generateClientCredentials('public', function (err, access_token) {
if (err) {
console.log(err);
}
var token = access_token.access_token;
lib.access_token = token;
// Other useful information is included alongside the access token
// We include the final scopes granted to the token. This is important because the user (or api) might revoke scopes during the authentication process
var scopes = access_token.scope;
});
module.exports = lib;
Edit2: After installing vimeo 0.1.4 module
first server startup was succesfull, vimeo api was working fine, but after restart, on any api request, I am recieving
error: A valid user token must be passed
.
Sometimes it works after server reload, sometimes it starts throwing this errors.
回答1:
This is a temporary server side error. Vimeo has pushed an update to the official node.js library that should bypass the problem while we work on resolving the issue.
Make sure you are using the package vimeo
, NOT vimeo-api
and you are on version 1.1.3
回答2:
As already said in the comments, I have experienced the same issues when requesting upload tickets. I think the problem lies in the vimeo.js node-api not sending Content-Length headers when doing post requests.
I have a fork of the repo here (https://github.com/johnnycrab/vimeo.js), where I am adding the Content-Length header, resolving all my issues for now. The method I am changing is Vimeo.prototype.request
in the vimeo.js file, if you want to avoid my other changes.
来源:https://stackoverflow.com/questions/29954095/vimeo-api-for-node-js-html-error-sorry-vimeo-will-be-right-back