question

FahdAbrahams-2452 avatar image
0 Votes"
FahdAbrahams-2452 asked ryanchill commented

Static Web App API

Hi,

I recently started the Microsoft learning track, whereby one creates an app by means of utilizing Azure, Github, node.js, npm and the Microsoft sandbox. After having followed all the instructions, the API won't seem to load in the web app although it loads when I accessed it locally through my web browser. I do understand that this is merely for learning purposes, although I like to do things right the first time. I have performed several commits, push and pulls to Github with very little success in loading the API from the preview URL. Please help.

azure-webapps-development
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ryanchill avatar image
0 Votes"
ryanchill answered ryanchill commented

Hi @FahdAbrahams-2452,

Sorry to hear that you weren't able to get your app up and running. I assure, it's not that difficult. If you followed similar steps as I've done, you can enable to application logging on your app to determine what's causing your app not to start.

10578-2020-06-24-10-32-54-readbetterinbyryan-app-service.png

Other things to look at is to check to .listen(...) to ensure App Service will bind to your node app. You don't need to specify host and use process.ENV.port so your node app will bind to the environmet variable. By default, this is 8080. If it's a dependency issue, you can adjust the nodejs runtime of your app service from the General Settings under the Confiugration blade. If any these don't help, let me know.



· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Okay.

It's a bit different though as I have specified my api's location within the web apps working directory. And whilst I do a commit all, pull, push to github and watch as my app builds, it shows that the api location cannot be found even though setup exactly the way shown on the 'publish a web app with azure' training. Just wanted to know if anyone else has experienced this problem. I would also like to add that my app does load successfully locally along with the api, which is why I am a bit confused.

0 Votes 0 ·

My apologies for the confusion @FahdAbrahams-2452. Just to make sure you have both a web app and API being deployed. It sounds like you're using either GitHub actions or Azure Pipelines with a yaml file. Can you share a screen shot from GitHub where it says your API locaiton cannot be found? Or is it that your web app can't find your api?

0 Votes 0 ·

@FahdAbrahams-2452 Can you please share the training that you are trying to follow? I'm unfamiliar with the training you mentioned so it would help to see exactly what they're asking you to do.


In regards to the API not working in Azure, what version of NPM are you using? Can you try to add a verbose flag to your install cmd to see if any helpful information can be outputted?


We look forward to your reply.


0 Votes 0 ·