Getting error ( POST 500 Internal Server Error) when running Full-Stack Web application in Azure

Behrooz 1 Reputation point
2021-04-26T15:55:07.83+00:00

I have developed a full-stack application with Vue 2, Node , Express and Postgres. I could deploy the application to Azure , and the system coming up, but when I try to do register user with Register page that I have created , I get " POST … 500 (Internal Server Error) ", **as I have tried with Postman , there is no issue in saving user data with same post controller ** .

Notice that I have set BaseURL to ‘’ in Api.js ( Client ):

import axios from ‘axios’  
import store from ‘@/store/store’  
export default () => {  
   return axios.create({  
      baseURL: ‘’,  
      headers: {  
           Authorization: Bearer ${store.state.token}  
      }  
   })  
}  

this is Register controller in /Controller folder :

//Registering user  
async register(req, res) {  
const hash = bcrypt.hashSync(req.body.password, 10);  
     try {  
         const user = await User.create(  
         Object.assign(req.body, { password: hash })  
      );  
   const userJson = user.toJSON();  
   res.send({  
          user: userJson,  
          token: jwtSignUser(userJson),  
         });  
  } catch (err) {  
     res.status(500).send({  
     error: There is error in registering: ${err},  
 });  
 }  
},  

I have added the following web.config file in dist folder, but it doesn't resolve the issue , also I have added web.config in root and has same issue :

<configuration>  
  <system.webServer>  
    <staticContent>  
      <mimeMap fileExtension="woff" mimeType="application/font-woff" />  
      <mimeMap fileExtension="woff2" mimeType="application/font-woff" />   
    </staticContent>  
    <rewrite>  
        
      <rules>  
                <clear />  
                <rule name="Redirect to https" stopProcessing="true">  
                    <match url=".*" />  
                    <conditions>  
                        <add input="{HTTPS}" pattern="off" ignoreCase="true" />  
                    </conditions>  
                    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />  
                </rule>  
            </rules>  
    </rewrite>  
       
      <httpErrors>       
          <remove statusCode="404" subStatusCode="-1" />                  
          <remove statusCode="500" subStatusCode="-1" />  
          <error statusCode="404" path="/survey/notfound" responseMode="ExecuteURL" />                  
          <error statusCode="500" path="/survey/error" responseMode="ExecuteURL" />  
      </httpErrors>  
      <modules runAllManagedModulesForAllRequests="true"/>  
  </system.webServer>  
</configuration>  

Could you please let me know how I could resolve the issue .

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,909 questions
{count} votes