codestates / codestates/BaedalDutch
[Error-log] S3 이미지 업로드 AWS 에러 (feat. ACL)
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
### ISSUE
- Group: `client`
- Type: `error`
- Detail:
### Error Message
> 스크린샷 또는 코드 공유

- 클라이언트에서 S3로 보내주는 로직을 구현하고 react-app에서 실행했지만 계속 오류가 뜨고 디버거가 실행되었다.
```js
const params = {
ACL: 'public-read',
Body: file,
Bucket: S3_BUCKET,
Key: file.name,
ContentType: 'image/png, image/jpeg, image/gif',
};
myBucket.putObject(params, (err, data) => {
console.log('params:', params);
const imageSrc = `https://${S3_BUCKET}.s3.${REGION}.amazonaws.com/${file.name}`;
console.log('imageSrc:', imageSrc);
```
### Solution
> 원인과 해결과정
이 과정에서 콘솔 로그들은 모두 잘 찍혀들어와서 로직 상 문제라기보다 S3 설정이 문제라고 생각했고
```js
console.log('loginUser:', loginUser);
console.log('data:', data);
console.log('err:', err);
```
`putObject`의 두번째 인자인 `data`와 `err`까지 모두 데이터로 찍었더니 맨 위 사진같이 에러 로그가 출력되었다.
```js
The bucket does not allow ACLs
```
이 문장으로 구글링을 해보니 S3에서 권한 - 객체 소유권 편집 문제였고 아래와 같이 수정하니 잘 작동했다 !

Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.