Skip to content

Bug: Issue with URL Generation in nport using API method #3

@gitSambhal

Description

@gitSambhal

Hi @tuanngocptn Found a bug when using the package in API

The script hangs when using nport.link without server subdomain. Additionally, the generated URL format is incorrect.

const socketTunnel = require('nport/lib/api');

const main = () => {

  // The script just hangs on using the nport.link without the subdomain
  // const server = 'https://nport.link'; 

  const server = 'https://server.nport.link';
  const subDomain = 'my-subdomain';
  const port = 3000;

  socketTunnel
    .connect(server, subDomain, port)
    .then((url) => {
    // The output url is https://my-subdomain.server.nport.link and it doesn't work
    // but accessing the url https://my-subdomain.nport.link works.
    // so the output should be correct working url.
      console.log('🚀 ~ .then ~ url:', url);  // Incorrect URL format
    })
    .catch((err) => {
      console.error(err);
    });
};

main();

Expected Behavior:
The correct URL https://my-subdomain.nport.link should be returned.

Actual Behavior:
The returned URL is https://my-subdomain.server.nport.link, which doesn’t work. Accessing https://my-subdomain.nport.link works fine.

Environment:
• Version of nport: 1.0.6
• Node.js version: 20.15.0
• OS: Mac

Additional Context:
• The script hangs when nport.link is used without a subdomain in server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions