问题描述
我正在将 Vimeo api
用于 node.js
,现在遇到了以前从未发生过的问题。尝试尝试 lib.generateClientCredentials
时会引发错误(并使节点应用程序崩溃):
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>]
因此:
1。为什么会发生?
2.为什么在服务器端api中将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?)
编辑:
我的 Vimeo-API
配置模块(与 Vimeo
文档中的示例基本相同):
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:安装 vimeo 0.1.4之后module
第一次服务器启动成功,vimeo api正常运行,但是重新启动后,在任何api请求下,我都收到了
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
错误:必须传递有效的用户令牌
。
有时服务器重载后它可以工作,有时会开始抛出此错误。 / p>
Sometimes it works after server reload, sometimes it starts throwing this errors.
推荐答案
这是服务器端的临时错误。 Vimeo已将更新推送到官方的node.js库,该库应在解决问题时绕过该问题。
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.
请确保您使用的软件包 vimeo
,而不是 vimeo-api
,而您使用的是版本 1.1.3
Make sure you are using the package vimeo
, NOT vimeo-api
and you are on version 1.1.3
这篇关于Vimeo-API for node.js HTML错误'对不起。 Vimeo马上回来'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!