我正在尝试遵循documentation上传大于2MB的文件。
我需要的地方在Laravel Nova自定义组件中,所以我正在使用以下代码:
window.Vapor = require('laravel-vapor');
Vapor.store(this.file, {
progress: progress => {
this.uploadProgress = Math.round(progress * 100);
}
}).then(response => {
axios.post('/example', {
uuid: response.uuid,
key: response.key,
bucket: response.bucket,
name: this.file.name,
content_type: this.file.type,
})
});
我的结果是,如果我尝试上传任何文件,都会收到500服务器错误,并显示以下日志:
local.ERROR: Unable to issue signed URL.
Missing environment variables: AWS_BUCKET, AWS_DEFAULT_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
{"userId":"auth0|my-user-hash",
"exception":"[object] (InvalidArgumentException(code: 0):
Unable to issue signed URL. Missing environment variables:
AWS_BUCKET, AWS_DEFAULT_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
at /my-path/vendor/laravel/vapor-core/src/Http/Controllers/SignedStorageUrlController.php:109)
以某种方式不能获取我的.env变量。当然,我已经正确设置了它们,因为它们已在应用程序的其他地方使用。我是否应该将这些复制到某个地方,特别是对于这种新星组件?