We have created AZURE Static WebApp and Private endpoint in Azure cloud and the Static webapp fqdn is mapped to the privateendpoint ip by creating the DNS record in Private DNS zone.
Now the nslookup and name resolution is showing fine when we are testing it from the same virtual network range and telnet over 443 also working.
As a next step we were trying to deploy the node apps .dist folder using swa cli command line as below and which is getting failed.
swa deploy ./dist/ –env production –deployment-token xxxxxxxx
Welcome to Azure Static Web Apps CLI (1.1.2)
Deploying front-end files from folder:
/home/user/swa/test/dist
Consider providing api-language and version using --api-language and --api-version flags,
otherwise default values apiLanguage: node and apiVersion: 16 will apply
Deploying to environment: production
Deploying project to Azure Static Web Apps...
✖ Failed to contact content server, stopping...
✖ An unknown exception has occurred
2
Answers
I’m assuming your running the cli command from a VM attached to the same vnet, similar to this workflow, since you stated that nslookup returns the correct record.
Based on what you posted, I was reading through deploy.ts to see where it may have failed. I came across Swa deploy fails with an unknown exception has occurred and it sounds very similar to your issue; however, no resolution was posted. I would run
swa deploy --verbose=silly
to see how far down it goes before it finally failed.My assumption is the deploy command is either using the original SWA endpoint which is not receiving internet traffic and not using the PE.
I’ve posted this question on that GitHub issue, and I’ll reach out to the PM team for further investigation.
I’m a product manager on Static Web Apps. It seems possible that with the configuration you described, you are attempting to deploy to Static Web Apps from your private network over the private endpoint (similar to this thread on our community GitHub https://github.com/Azure/static-web-apps/issues/1245)
Today, private endpoints does not apply to deployment to Static Web Apps. Deployment cannot be restricted to a private endpoint due to the distributed nature of Static Web Apps content hosts. This is an area we are investigating however.
Hope this helps!