When App run on local, I can upload file to Azure Blob Storage.
But when I deploy app to Azure App Service, it always responses 502 Bad Gateway
I use library koa-body
to handle upload file
const koaBody = require('koa-body')({ multipart: true, uploadDir: '.' });
const blobServiceClient = BlobServiceClient.fromConnectionString(AZURE_STORAGE_CONNECTION_STRING);
const videoContainerClient = blobServiceClient.getContainerClient(AZURE_VIDEO_STORAGE_CONTAINER);
const blobVideoName = `${fileName}.${fileExtension}`;
const blockBlobVideo = videoContainerClient.getBlockBlobClient(blobVideoName);
const uploadVid = blockBlobVideo.uploadFile(filePath);
I think the problem is I don't have permission to write file to os.tmpDir()
, so I try to go to Kudu Debug Console
and set chmod -R 0755
to home/site/wwwroot/public/tmp
, the folder I think is os.tmpDir()
. But it said I don't have permission
Any help is appreciated
You can refer to my sample code.(Download my samle code)
Test Result.
POST test url : https://yourappname.azurewebsites.net/user/upload