<!-- 
RSS generated by JIRA (9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13) at Sat Jan 11 08:27:23 UTC 2025

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Mojang Studios Jira</title>
    <link>https://bugs.mojang.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en</language>    <build-info>
        <version>9.12.2</version>
        <build-number>9120002</build-number>
        <build-date>10-01-2024</build-date>
    </build-info>


<item>
            <title>[BDS-19922] server.net module not working as expected on Linux</title>
                <link>https://bugs.mojang.com/browse/BDS-19922</link>
                <project id="11700" key="BDS">Bedrock Dedicated Server</project>
                    <description>&lt;p&gt;Not sure if this is an issue related to just the newest version, or if it effects older versions as well. I just encountered this issue when creating a new addon.&lt;/p&gt;

&lt;p&gt;Basically I created an addon that uses the server.net module for the scripting API, which sends a HTTP post request to a web server I have running locally when a player leaves or joins the server. I have tested the addon on the Windows version on BDS (Test Server) and it worked perfectly. Comes time to add it to the live server I have running on Linux, and I have issues.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;The server console tells me that the addon has loaded sucessfully, and most functions of the addon work perfectly fine. The issues start when this line of code is run.&lt;/p&gt;

&lt;p&gt;const response = await http.request(req);&lt;/p&gt;

&lt;p&gt;Which is the line that sends the HTTP post request to the web server. Here is the whole function&lt;/p&gt;

&lt;p&gt;&#160;&lt;br/&gt;
async function logPlayerJoinOrLeave(player, totalOnline, connectOrDisconect) {&lt;br/&gt;
&#160; &#160; try {&lt;br/&gt;
&#160; &#160; &#160; &#160; let responseBody = &quot;API calls quota exceeded! maximum admitted 1 per 3s.&quot;;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; // Ensure that &apos;players&apos; and &apos;key&apos; are not undefined or empty&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; if (!players || !players.length) &lt;/p&gt;
{
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; console.error(&quot;Error: &apos;player&apos; field is missing or empty.&quot;);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; return; // Exit if players is missing or empty
&#160; &#160; &#160; &#160; &#160; &#160; }
&lt;p&gt;&#160;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; const key = &quot;XXXX&quot;;&#160; // Make sure to replace with a valid key if needed&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; if (!key) &lt;/p&gt;
{
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; console.error(&quot;Error: &apos;key&apos; field is missing.&quot;);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; return; // Exit if key is missing
&#160; &#160; &#160; &#160; &#160; &#160; }
&lt;p&gt;&#160; &#160; var URL = &apos;http://xxx.xxx.x.xxx:xxxx/LogPlayerActivity?player=&apos; + player + &apos;&amp;amp;totalOnline=&apos; + totalOnline + &apos;&amp;amp;connectOrDisconect=&apos; + connectOrDisconect + &apos;&amp;amp;key=&apos; + key;&#160; &#160; &#160;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; URL = URL.replace(/\s+/g, &apos;%20&apos;);&#160; &#160; &#160; &#160; &#160; &#160;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; const req = new HttpRequest(URL);&#160; &#160; &#160;&#160;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; req.method = HttpRequestMethod.Post;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; req.headers = [&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; new HttpHeader(&apos;accept&apos;, &apos;text/plain&apos;),&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; ];&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#160;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; // Await the request and log the response or error&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; ***&lt;b&gt;//const response = await http.request(req);&lt;/b&gt;***&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; responseBody = response.body&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160;&lt;br/&gt;
&#160;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; if(responseBody == &quot;API calls quota exceeded! maximum admitted 1 per 3s.&quot;){&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; server.system.runTimeout(() =&amp;gt; &lt;/p&gt;
{
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; logPlayerJoinOrLeave(player, totalOnline, connectOrDisconect)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&lt;p&gt;, 3000);&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; }&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#160;&lt;br/&gt;
&#160; &#160; } catch (error) &lt;/p&gt;
{
&#160; &#160; &#160; &#160; console.error(&quot;Request failed:&quot;, error); // More detailed error logging
&#160; &#160; }
&lt;p&gt;}&lt;br/&gt;
This is the event listener that triggers the above function&lt;/p&gt;

&lt;p&gt;world.afterEvents.playerJoin.subscribe(e =&amp;gt; &lt;/p&gt;
{&#160;
&#160; &#160; var player = e.playerName
&#160; &#160; var totalOnline = world.getAllPlayers().length + 1; &#160;
&#160; &#160; var connectOrDisconect = true &#160;&#160;
&#160; &#160; logPlayerJoinOrLeave(player, totalOnline, connectOrDisconect) &#160;&#160;
}
&lt;p&gt;)&lt;/p&gt;

&lt;p&gt;When I uncomment the offending line, when a player joins the server their game hangs on &quot;locating server&quot;. The console says the player has connected and spawned in, and if they click &quot;cancel&quot; or close the game the console shows them disconecting. If I try to stop the server using the &quot;stop&quot; command after a player attempted to connect, the server also hangs and I have to force close it. And no, the HTTP post request never goes through.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Not sure if this is a known bug or if there is a work around, but for now I am not logging player connects or disconnects. I am assuming this is some form of bug since the above code works flawlessly on the Windows version on BDS.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment>Linux</environment>
        <key id="574061">BDS-19922</key>
            <summary>server.net module not working as expected on Linux</summary>
                <type id="1" iconUrl="https://bugs.mojang.com/secure/viewavatar?size=xsmall&amp;avatarId=18903&amp;avatarType=issuetype">Bug</type>
                                    <status id="1" iconUrl="https://bugs.mojang.com/images/icons/statuses/open.png" description="The issue is open and ready for the assignee to start work on it.">Open</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="MCStorm">Tyler</reporter>
                        <labels>
                    </labels>
                <created>Sun, 8 Dec 2024 07:52:34 +0100</created>
                <updated>Sun, 8 Dec 2024 07:52:34 +0100</updated>
                                            <version>1.21.50</version>
                                                            <votes>0</votes>
                                    <watches>0</watches>
                                                                                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                <customfield id="customfield_10500" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Confirmation Status</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10300"><![CDATA[Unconfirmed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_12700" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Description</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>[Briefly describe the bug here]&lt;br/&gt;
&lt;br/&gt;
*Steps to Reproduce:*&lt;br/&gt;
# [Step 1]&lt;br/&gt;
# [Step 2]&lt;br/&gt;
# [Step 3]&lt;br/&gt;
&lt;br/&gt;
*Observed Results:*&lt;br/&gt;
[Describe what happens]&lt;br/&gt;
&lt;br/&gt;
*Expected Results:*&lt;br/&gt;
[Describe what should happen]&lt;br/&gt;
&lt;br/&gt;
*Screenshots/Videos attached:* [please attach an image or short video]&lt;br/&gt;
&lt;br/&gt;
*Notes:*</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11700" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_11100" key="com.atlassian.jira.plugin.system.customfieldtypes:float">
                        <customfieldname>Linked</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_11600" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i2k9dj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    </customfields>
    </item>
</channel>
</rss>