File tree Expand file tree Collapse file tree 3 files changed +17
-13
lines changed Expand file tree Collapse file tree 3 files changed +17
-13
lines changed Original file line number Diff line number Diff line change 19
19
"@feathersjs/feathers" : " ^4.5.3" ,
20
20
"@feathersjs/socketio" : " ^4.5.4" ,
21
21
"@feathersjs/transport-commons" : " ^4.5.3" ,
22
+ "@types/aws-sdk" : " ^2.6.1" ,
22
23
"@types/bluebird" : " ^3.5.32" ,
23
24
"@types/cors" : " ^2.8.6" ,
24
25
"@types/lodash" : " ^4.14.155" ,
25
26
"@types/mongoose" : " ^5.7.23" ,
27
+ "@types/node" : " ^14.0.27" ,
28
+ "@types/uuid" : " ^8.0.1" ,
26
29
"@typescript-eslint/eslint-plugin" : " ^3.2.0" ,
27
30
"@typescript-eslint/parser" : " ^3.2.0" ,
28
- "aws-sdk" : " ^2.729.0 " ,
31
+ "aws-sdk" : " ^2.6.1 " ,
29
32
"bluebird" : " ^3.7.2" ,
30
33
"cors" : " ^2.8.5" ,
31
34
"feathers-hooks-common" : " ^5.0.3" ,
47
50
"homepage" : " https://github.com/eug-vs/which-api#readme" ,
48
51
"description" : " " ,
49
52
"devDependencies" : {
50
- "@types/aws-sdk" : " ^2.7.0" ,
51
- "@types/uuid" : " ^8.0.1" ,
52
53
"eslint" : " ^7.2.0" ,
53
54
"eslint-config-airbnb-typescript" : " ^8.0.2" ,
54
55
"eslint-plugin-import" : " ^2.21.2"
Original file line number Diff line number Diff line change 1
1
import { Application } from '@feathersjs/express' ;
2
2
import { Params } from '@feathersjs/feathers' ;
3
- import { S3 } from 'aws-sdk' ;
4
- import { v4 as uuidv4 } from 'uuid' ;
3
+ import { v4 } from 'uuid' ;
4
+
5
+ // Use require to avoid bug
6
+ // https://stackoverflow.com/questions/62611373/heroku-crashes-when-importing-aws-sdk
7
+ const S3 = require ( 'aws-sdk/clients/s3' ) ;
5
8
6
9
7
10
export default class Files {
8
11
app ! : Application ;
9
- s3 ! : S3 ;
12
+ s3 ! : any ;
10
13
bucket ! : string ;
11
14
12
15
async find ( params : Params ) : Promise < string > {
13
16
// Return signed upload URL
14
17
return this . s3 . getSignedUrl ( 'putObject' , {
15
18
Bucket : this . bucket ,
16
- Key : `${ params . user ?. username } /${ uuidv4 ( ) } .png` ,
19
+ Key : `${ params . user ?. username } /${ v4 ( ) } .png` ,
17
20
ContentType : 'image/*' ,
18
21
Expires : 300 ,
19
22
} ) ;
You can’t perform that action at this time.
0 commit comments