talawa-api icon indicating copy to clipboard operation
talawa-api copied to clipboard

API fails if the `SERVER_PORT` variable is not in the `.env` file

Open palisadoes opened this issue 1 year ago • 12 comments

Describe the bug

API fails if the SERVER_PORT variable is not in the .env file

To Reproduce Steps to reproduce the behavior:

  1. Remove the SERVER_PORT variable from the .env file
  2. Start the API
  3. Errors are seen

Expected behavior

  1. The API should default to a SERVER_PORT if the variable is not in the .env file
  2. We need valid passing tests created to make sure that this is not repeated

Actual behavior

  • See above

Screenshots

image

Additional details

The feature was added in this PR, but this edge case was not considered

  • https://github.com/PalisadoesFoundation/talawa-api/issues/2259

Potential internship candidates

Please read this if you are planning to apply for a Palisadoes Foundation internship https://github.com/PalisadoesFoundation/talawa/issues/359

palisadoes avatar May 05 '24 17:05 palisadoes

@NamitBhutani If you have the time, you may want to take a look at this.

palisadoes avatar May 05 '24 17:05 palisadoes

@NamitBhutani If you have the time, you may want to take a look at this.

Although I tested this case, I'll take a look again.

NamitBhutani avatar May 05 '24 17:05 NamitBhutani

Hey @palisadoes, I am thinking of fixing this issue, can you please assign it to me?

TARishabh avatar May 07 '24 19:05 TARishabh

@TARishabh If the issue has already been assigned, please don't ask to be assigned. We want everyone to get a chance.

Cioppolo14 avatar May 08 '24 00:05 Cioppolo14

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

github-actions[bot] avatar May 19 '24 00:05 github-actions[bot]

  1. Inactive, unassigning
  2. Are you still working on this?

palisadoes avatar May 19 '24 14:05 palisadoes

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

github-actions[bot] avatar May 30 '24 00:05 github-actions[bot]

@palisadoes I have come up with a solution, can you please assign the issue to me?

Suyash878 avatar Jun 14 '24 02:06 Suyash878

@Cioppolo14 I would really like to work on this issue.

Suyash878 avatar Jun 16 '24 06:06 Suyash878

@Suyash878 How are you planning to solve this issue? If we have a clear plan then we are ready to go solve this issue easily

varshith257 avatar Jun 16 '24 11:06 varshith257

@varshith257 I was planning on running one final check in the src/index.ts file using the isNaN() function to get to know about the nature of the port if in case it is undefined, and if it returns undefined then switching the port to 4000.

The code snippet looks something like this:

image

Terminal snippet:

image

Suyash878 avatar Jun 16 '24 13:06 Suyash878

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

github-actions[bot] avatar Jun 27 '24 00:06 github-actions[bot]