내 애플리케이션을 IntoVPS에서 Digital Ocean로 마이그레이션 한 후 내 AWS S3에 사진을 업로드하려고 할 때 내 응용 프로그램이 충돌합니다.AWS S3에 연결할 때 Node.js가 충돌 함
서버 간의 차이점은 다음과 같습니다. IntoVPS는 Ubuntu 10.10을 실행 중이며 Digital Ocean은 Debian을 실행 중입니다. IntoVPS 노드는 0.8.x이고 Digital Ocean은 0.10.26입니다.
새 서버에이 문제의 원인이 될 수있는 방화벽이 없습니다 (확인했습니다).
충돌 오류는 다음과 같습니다
Error: read ECONNRESET
at errnoException (net.js:904:11)
at Pipe.onread (net.js:558:19)
Error: spawn ENOENT
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
Error: write EPIPE
at errnoException (net.js:904:11)
at Object.afterWrite (net.js:720:19)
이들 중 일부
영원히 프로세스를 다시 시작하려고 관련 될 수있다 (I 그 부활이 의미 할 수 있습니다 무엇을 생각). 내가 집중하고자하는 것은 ECONNRESET입니다.그래서 영원히 내 프로세스를 실행 중이며 knox 모듈을 사용하여 S3에 연결합니다.
인터넷 검색 후 나는 발견 https://github.com/LearnBoost/knox/issues/198
내가 putFile
의 콜백 res.resume()
를 추가하는 시도는 말한다,하지만 아무것도 변경되지처럼; ECONNRESET 오류가 발생합니다.
나는이 문제를 해결하기 위해 하루 종일 (어제) 노력 했으므로 프로덕션 응용 프로그램이 손상 될 수 없으므로 일시적으로 이전 버전의 노드로 전환하려고했습니다. (그러나 빨리)이 문제를 해결합니다. 그래서, 노드 버전을 설치할 때 n 모듈을 설치하여 0.8.26을 얻었습니다. 불행하게도, n은 내가 그에서 만든 문제를 작동하고, 여기되지 않았다 https://github.com/visionmedia/n/issues/170
편집 :
내 SSH 세션을 종료하고 새를 열고, N 노력하고 있습니다 후. 그러나 노드의 0.8.26 버전으로 전환하는 것은 또 다른 오류가 발생합니다 :
/apps/Foobar/node_modules/dnode/node_modules/weak/node_modules/bindings/bindings.js:83
throw e
^
Error: Module version mismatch, refusing to load.
at Object.Module._extensions..node (module.js:485:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at bindings (/apps/Foobar/node_modules/dnode/node_modules/weak/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (/apps/Foobar/node_modules/dnode/node_modules/weak/lib/weak.js:1:97)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/apps/Foobar/node_modules/dnode/index.js:5:12)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/apps/Foobar/controllers/sock.js:2:13)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at global.Controller (/apps/Foobar/globals.js:2:9)
at Object.<anonymous> (/apps/Foobar/controllers/generosity.js:209:12)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at global.Controller (/apps/Foobar/globals.js:2:9)
at Object.<anonymous> (/apps/Foobar/app.js:282:1)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:245:9)
(당신은 내가 S3와 함께이 문제를 해결하기 위해 노력 darnedest 시간을 보내고있어 볼 수있다, 나는 우는 지점 해요으로 은유 적으로). 나는이 문제에 대해 시간을 낭비하지는 못한다. 그러나 나는 그것을 풀 수없는 것 같다. 그것은 Node 자체가 깨진 것과 거의 같습니다.
누구에게 무슨 일이 일어나고 있는지 통찰력을 줄 수 있습니까? 어떤 도움을 주셔서 감사합니다.
왜 녹스가 더 이상 작동하지 않습니까?
편집
여기에 자세한 내용입니다.
코드가 오류 :
// S3
var endpoint = "https://s3.amazonaws.com/"+global.config.aws.s3.bucket+"/";
var knox = require('knox');
var s3 = knox.createClient(global.config.aws.s3);
var photosPrefix = 'photos/';
var model = module.exports;
model.emitter = new events.EventEmitter;
// ::Photos
model.createPhoto = function(info, cb){
if (!info.file || path.resolve(info.file) === path.resolve(global.__tempdir))
return cb(new Error('missing info.file'));
var db = info.db;
var photoId;
if (typeof info.public === 'undefined')
info.public = false;
// Move file to a specific location
var basename = path.basename(info.file);
var destination = photosPrefix+basename+'/original';
yarn
(function(){
// Upload photo to AWS
s3.putFile(
info.file,
destination,
{
'Content-Type': 'image/png'
},
this());
})
(function(err, res){
if (err) return this.error(new Error(err));
// Remove temporary file
fs.unlink(info.file, this());
})
(function(err){
if (err) return this.error(new Error(err));
// Retrieve photo stream from AWS
s3.getFile(destination, this());
})
(function(err, res){
if (err) return this.error(new Error(err));
// Get the dimensions of the photo using the stream (res)
gm(res).size(this());
})
(function(err, size){
if (err) return this.error(new Error(err));
// Insert record into photos table (include the dimensions, width and height)
db.query("INSERT photos (resource, width, height, public) VALUES (?, ?, ?, ?)", [basename, size.width, size.height, info.public], this());
})
(function(err, results){
if (err) return this.error(new Error(err));
photoId = results.insertId;
cb(null, photoId);
})
.error(function(err){
cb(err);
});
}
모든 사진 크기 나 형식이 같은 오류가 발생할 상관없이.
"당연히 내가 한"질문일지도 모르지만 node_modules를 지우고 노드를 다운 그레이드 한 다음 다시 설치 했습니까? 0.8.x에서 0.10.x 사이의 변경 사항을 깨는 것은 사용자가 보유한 모듈에 영향을 미친다는 것입니다. 또한 npm이 모듈의 "엔진"(어쨌든 유용하지 않을 수도 있음)을 기반으로 올바른 이전 버전을 설치하기에 충분히 스마트 한 지 또는 버전을 수동으로 지정해야하는지 여부는 알지 못합니다. 나는 다운 그레이드를 할 기회가 없었다. 누군가이 경우 npm 동작을 확인할 수 있습니다. 의사가 내가 볼 수 있다고 명시하지 않았습니다. –