I used NextJS to upload image file to alibaba oss from origin http://localhost:3000 to bucket in Alibaba Cloud. I was already set CORS, but it still not work. How can I do that? enter image description here
here is the result enter image description here
here is my code
import co from 'co'
import OSS from 'ali-oss'
const client = new OSS({
region: 'oss-ap-southeast-3',
accessKeyId: '<accesskeyid>',
accessKeySecret: '<accesskeysecret>',
bucket: '<my bucket name>'
});
const onSubmit = () => {
co(function* () {
var result = yield client.put('image', images);
console.log(result);
}).catch(function (err) {
console.log(err);
});
}