Messenger Extension SDK is throwing error on getContext
2

When I open a Webview that executes the code below, It shows 32603(internal error) on my PC/Chrome Version 129.0.6668.70 (Official Build) (64-bit), 2071011 on my android phone (Android 14, messenger version 477.0.0.50.99) and 2018154 error on my IPhone(Messenger version 477.0.0)

I have whitelisted my domain(https://xxxxx.store/) and enabled messenger extension.

This is my webview button setup code:

    let message = {
        attachment: {
            type: "template",
            payload: {
                template_type: "button",
                text: "Please provide the product combination here",
                buttons: [{
                    title: "Product Combinations",
                    type: "web_url",
                    url: `https://xxxxx.store/views/set-combinations?psid=${sender_id}&api_domain=${domain[0][`page_api_domain`]}&accessToken=${apiAccessToken[0]['page_api_token']}&page_id=${page_id}&product_id=${product_id}`,
                    webview_height_ratio: "tall",
                    messenger_extensions: true
                }],
            },
        }
    }

This is my Webview code:

let isSupported = false
window.extAsyncInit = function() {
    isSupported = true;
    console.log(`the Messenger Extensions JS SDK is done loading: ${isSupported}`)
    //
    MessengerExtensions.getSupportedFeatures(function success(result) {
        let features = result.supported_features;
        if (features.indexOf("context") !== -1) {
            MessengerExtensions.getContext('XXXXXXXX',
                function success(thread_context) {
                    // success
                    console.log(`user psid ${thread_context.psid}`)
                    matha.innerHTML =`user psid ${thread_context.psid}`
                    // document.getElementById("psid").value = thread_context.psid;
                    // More code to follow
                },
                function error(err, errMsg) {
                    console.log(`${err} ${JSON.stringify(errMsg)}`);
                    matha.innerHTML = `${err} ${JSON.stringify(errMsg)}`
                }
            );
        }
    }, function error(err) {
        matha.innerHTML = `Err : ${err}`
        console.log(err);
    });

}
Riyad
Asked about a month ago