DialogContextError when handling files

I’m trying to handle files in bot framework in teams.

I have a dialog with this function :

async finalStep(stepContext) {
    if (stepContext.result && stepContext.result.length > 0) {
        stepContext.values.files = await Promise.all(stepContext.result.map(async file => ({
            filename: file.name,
            fileContent: await this.getFileContentInBase64(file.contentUrl)
        })));
    } else {
        stepContext.values.files = [];
    }

    const userProfile = await this.userState.get(stepContext.context, {});
    const aadObjectId = userProfile.aadObjectId;

    const finalData = {
        userId: aadObjectId,
        cet: stepContext.values.cet,
        sector: stepContext.values.sector,
        job: stepContext.values.job,
        requestType: stepContext.values.requestType,
        description: stepContext.values.description,
        files: []
    };


    const apiUrl = ''; // power automate url

    try {
        const response = await axios.post(apiUrl, finalData, {
            headers: {
                'Content-Type': 'application/json'
            }
        });
        const ticketId = response.data.id;

        await stepContext.context.sendActivity(t('dt_ticket.ticket_created', { ticketId }));

        const accessToken = await getAccessToken();
        const siteId = '';
        const driveId = '';
        const folderId = '';

        await this.uploadFilesToGraph(accessToken, siteId, driveId, folderId, stepContext.values.files, ticketId);

    } catch (error) {
        console.error('Error sending data to the API: ', error.response ? error.response.data : error.message);
    }

    return await stepContext.endDialog();
}



async getFileContentInBase64(contentUrl) {
    const response = await axios.get(contentUrl, { responseType: 'arraybuffer' });
    return Buffer.from(response.data, 'binary').toString('base64');
}

async uploadFilesToGraph(accessToken, siteId, driveId, folderId, files, ticketId) {
    try {
        const client = Client.init({
            authProvider: (done) => {
                done(null, accessToken);
            }
        });

        for (const file of files) {
            //const fileContent = Buffer.from(file.fileContent, 'base64');

            // Create a small file with random content
            const fileName = file.filename;
            const fileContent = 'This is a random test content: ' + Math.random();
            fs.writeFileSync(fileName, fileContent);
            const fileBuffer = fs.readFileSync(fileName);

            const fileUploadUrl = `/sites/${siteId}/drives/${driveId}/items/${folderId}:/${ticketId} - ${file.filename}:/content`;

            const response = await client.api(fileUploadUrl).put(fileBuffer);

        }
    } catch (error) {
        this.logDebug('Error uploading files to Graph', { error: error });
    }
}

I modify this to try to juste upload a little text file. On emulator localhost, it’s working well, but when I’m using this code through teams bot, I have the following error :

Error: DialogContextError

And I don’t have more informations.
The part which catch the error on index.js :

// Catch-all for errors.
adapter.onTurnError = async (context, error) => {
    console.error(`n [onTurnError] unhandled error: ${ error }`);

    // Log error to Application Insights
    telemetryMiddleware.telemetryClient.trackTrace({
        message: 'Error',
        properties: { error: error.toString() },
        severityLevel: 3 // Error
    });

    // Send a trace activity
    await context.sendTraceActivity(
        'OnTurnError Trace',
        `${ error }`,
        'https://www.botframework.com/schemas/error',
        'TurnError'
    );

    // Send a message to the user
    await context.sendActivity('The bot encountered an error or bug.');
    await context.sendActivity('To continue to run this bot, please fix the bot source code.');
    await context.sendActivity('Error : ' + error);
};

I can’t figure out where the issue is, if you have some thoughts, would be great.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật