question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

URL returned is not formatted correctly

See original GitHub issue

I am trying to implement the electron release server and for now I am using docker compose to run it on my local machine.

here is my docker-compose.yml

version: '2'
services:
  web:
    build: .
    environment:
      APP_USERNAME: admin
      APP_PASSWORD: admin
      DB_HOST: db
      DB_PORT: 5432
      DB_USERNAME: releaseserver
      DB_NAME: releaseserver
      DB_PASSWORD: secret
      TOKEN_SECRET: change_me_in_production
      APP_URL: 'localhost:5000'
    depends_on:
      - db
    ports:
      - '5000:80'
    entrypoint: ./scripts/wait.sh db:5432 -- npm start
  db:
    image: postgres
    environment:
      POSTGRES_PASSWORD: secret
      POSTGRES_USER: releaseserver

When I call the server endpoint http://localhost:5000/update/osx_64/0.0.1 I get json back, but the url in the response is not correct

{
  "url": "localhost:/download/0.0.2/osx_64?filetype=zip",
  "name": "0.0.2",
  "notes": "",
  "pub_date": "2017-05-10T23:12:52.000Z"
}

you will notice that the port is missing. So i added some debug to VersionController.js

sails.log.debug('Version candidate accepted');
sails.log.debug('appUrl '+sails.config.appUrl);
sails.log.debug(sails.config.appUrl + '/download/' + latestVersion.name + '/' + latestVersion.assets[0].platform + '?filetype=zip');
sails.log.debug(url.resolve(
              sails.config.appUrl,
              '/download/' + latestVersion.name + '/' +
              latestVersion.assets[0].platform + '?filetype=zip'
            ));

and what I get back in the debug is

web_1  | debug: Version candidate accepted
web_1  | debug: appUrl localhost:5000
web_1  | debug: localhost:5000/download/0.0.2/osx_64?filetype=zip
web_1  | debug: localhost:/download/0.0.2/osx_64?filetype=zip

it looks like url.resolve() is removing the port. Is there any way to fix this?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
justechncommented, May 11, 2017

nevermind, I read this and changed my APP_URL to http://localhost:5000 and now it works. You should probably change your default yml to have the same

0reactions
stale[bot]commented, Oct 7, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Page URL not formatted properly to use in email? — oracle-tech
Hi, I am trying to create and send URL from apex.oracle.com but ... if the returned URL is having pls/apex then you can...
Read more >
NoMethod Error Given When URL is not formatted properly
The HTTP verb methods should raise an exception upon being given an improper URL as an argument. This exception should specify what URL...
Read more >
Http Response Not Formatting Json Data Correctly ASP Core ...
Here is the json data I get when I hit the URL, it is not closing correctly. I have been working on this...
Read more >
URL isn't formatting correctly into Gmail when input into ...
Google Form to GMail - I am putting a URL into a field on the form but it is not formatting correctly into...
Read more >
Why am I seeing an error 'The link is not formatted properly ...
You are seeing an error when directly clicking on this link as this will not have values for the Parameters on the link....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found