Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aws s3 don't work #2

Closed
marvin-zhao opened this issue Aug 28, 2019 · 5 comments
Closed

Aws s3 don't work #2

marvin-zhao opened this issue Aug 28, 2019 · 5 comments

Comments

@marvin-zhao
Copy link

marvin-zhao commented Aug 28, 2019

2019-08-28T08:05:49.848Z [4567/1207] - error: uncaughtException: Cannot read property 'Key' of undefined
TypeError: Cannot read property 'Key' of undefined
    at ManagedUpload.callback (/usr/src/app/node_modules/nodebb-plugin-cloudstorage/lib/controllers.js:218:93)
    at Response.finishSinglePart (/usr/src/app/node_modules/aws-sdk/lib/s3/managed_upload.js:674:28)
    at Request.<anonymous> (/usr/src/app/node_modules/aws-sdk/lib/request.js:364:18)
    at Request.callListeners (/usr/src/app/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/usr/src/app/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/usr/src/app/node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (/usr/src/app/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/usr/src/app/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /usr/src/app/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/usr/src/app/node_modules/aws-sdk/lib/request.js:38:9) {"error":{"message":"Cannot read property 'Key' of undefined","code":"TypeError","time":"2019-08-28T08:05:49.836Z"},"stack":"TypeError: Cannot read property 'Key' of undefined\n    at ManagedUpload.callback (/usr/src/app/node_modules/nodebb-plugin-cloudstorage/lib/controllers.js:218:93)\n    at Response.finishSinglePart (/usr/src/app/node_modules/aws-sdk/lib/s3/managed_upload.js:674:28)\n    at Request.<anonymous> (/usr/src/app/node_modules/aws-sdk/lib/request.js:364:18)\n    at Request.callListeners (/usr/src/app/node_modules/aws-sdk/lib/sequential_executor.js:106:20)\n    at Request.emit (/usr/src/app/node_modules/aws-sdk/lib/sequential_executor.js:78:10)\n    at Request.emit (/usr/src/app/node_modules/aws-sdk/lib/request.js:683:14)\n    at Request.transition (/usr/src/app/node_modules/aws-sdk/lib/request.js:22:10)\n    at AcceptorStateMachine.runTo (/usr/src/app/node_modules/aws-sdk/lib/state_machine.js:14:12)\n    at /usr/src/app/node_modules/aws-sdk/lib/state_machine.js:26:10\n    at Request.<anonymous> (/usr/src/app/node_modules/aws-sdk/lib/request.js:38:9)","exception":true,"date":"Wed Aug 28 2019 08:05:49 GMT+0000 (UTC)","process":{"pid":1207,"uid":0,"gid":0,"cwd":"/usr/src/app","execPath":"/usr/local/bin/node","version":"v8.16.0","argv":["/usr/local/bin/node","/usr/src/app/app.js"],"memoryUsage":{"rss":344420352,"heapTotal":147755008,"heapUsed":118478416,"external":19247672}},"os":{"loadavg":[0.74560546875,0.3125,0.15673828125],"uptime":340588},"trace":[{"column":93,"file":"/usr/src/app/node_modules/nodebb-plugin-cloudstorage/lib/controllers.js","function":"ManagedUpload.callback","line":218,"method":"callback","native":false},{"column":28,"file":"/usr/src/app/node_modules/aws-sdk/lib/s3/managed_upload.js","function":"Response.finishSinglePart","line":674,"method":"finishSinglePart","native":false},{"column":18,"file":"/usr/src/app/node_modules/aws-sdk/lib/request.js","function":null,"line":364,"method":null,"native":false},{"column":20,"file":"/usr/src/app/node_modules/aws-sdk/lib/sequential_executor.js","function":"Request.callListeners","line":106,"method":"callListeners","native":false},{"column":10,"file":"/usr/src/app/node_modules/aws-sdk/lib/sequential_executor.js","function":"Request.emit","line":78,"method":"emit","native":false},{"column":14,"file":"/usr/src/app/node_modules/aws-sdk/lib/request.js","function":"Request.emit","line":683,"method":"emit","native":false},{"column":10,"file":"/usr/src/app/node_modules/aws-sdk/lib/request.js","function":"Request.transition","line":22,"method":"transition","native":false},{"column":12,"file":"/usr/src/app/node_modules/aws-sdk/lib/state_machine.js","function":"AcceptorStateMachine.runTo","line":14,"method":"runTo","native":false},{"column":10,"file":"/usr/src/app/node_modules/aws-sdk/lib/state_machine.js","function":null,"line":26,"method":null,"native":false},{"column":9,"file":"/usr/src/app/node_modules/aws-sdk/lib/request.js","function":null,"line":38,"method":null,"native":false}]}
2019-08-28T08:05:49.850Z [4567/1207] - error: Cannot read property 'Key' of undefined {"code":"TypeError","time":"2019-08-28T08:05:49.836Z"}
@marvin-zhao marvin-zhao changed the title Aws 式 Aws s3 don't work Aug 28, 2019
@june07
Copy link
Owner

june07 commented Aug 29, 2019

Can you share what file you are trying to upload...

@marvin-zhao
Copy link
Author

I uploaded a picture. I modified the code to print err. I found that the reason was aws-sdk prompted AccessDenied. But I tried to use aws-sdk and my accesskey/sercetkey to upload the picture successfully.

@marvin-zhao
Copy link
Author

https://github.com/june07/nodebb-plugin-cloudstorage/blob/master/lib/controllers.js#L214
if (err) reject(err); can't catch error. The err causes nodebb to restart.

I'm not a nodejs developer and don't know much about the language.

@marvin-zhao
Copy link
Author

I found the reason that my bucket wasn't public.

But can't catch error is still a problem

@june07 june07 closed this as completed in 05f4374 Aug 29, 2019
@june07
Copy link
Owner

june07 commented Aug 29, 2019

Pushed a fix. Should have been returning after that reject call. Thanks for the help.

05f4374#diff-6b49b62ca6c8a7110bdda9c1189098aeR214-R215

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants