Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web_app example "Uknown error" #1367

Open
adriangalilea opened this issue Nov 16, 2023 · 2 comments
Open

web_app example "Uknown error" #1367

adriangalilea opened this issue Nov 16, 2023 · 2 comments

Comments

@adriangalilea
Copy link

Hello,

I simply tried running the provided web_app example

When I press Send Hello world I receive "Unknown error"

I noticed in the code

$('#btn_status').text('Sending...').removeClass('ok err').show();
        $.ajax('/demo/sendMessage', {
            type: 'POST',
            data: {
                _auth: initData,
                msg_id: msg_id || '',
                with_webview: !initDataUnsafe.receiver && with_webview ? 1 : 0
            },
            dataType: 'json',
            success: function (result) {
                $('button').prop('disabled', false);
                if (result.response) {
                    if (result.response.ok) {
                        $('#btn_status').html('Message sent successfully!').addClass('ok').show();
                    } else {
                        $('#btn_status').text(result.response.description).addClass('err').show();
                        alert(result.response.description);
                    }
                } else {
                    $('#btn_status').text('Unknown error').addClass('err').show();
                    alert('Unknown error');
                }
            },

But I'd like to understand the cause as I'm guessing is not expected to happen.

I tested both in my phone and computer.

Thank you!

@JrooTJunior
Copy link
Member

Seems like your API is not accesible from the World.

@adriangalilea
Copy link
Author

Hmm that is odd, the webapp was running fine. How could it be that I was seeing the webapp then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants