Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command line prints successful deploy, but no changes on Azure #13

Closed
ngfelixl opened this issue Dec 13, 2019 · 8 comments
Closed

Command line prints successful deploy, but no changes on Azure #13

ngfelixl opened this issue Dec 13, 2019 · 8 comments

Comments

@ngfelixl
Copy link

ngfelixl commented Dec 13, 2019

Describe the bug

Hexa CLI prints successfully deployed, but there are no changes on Azure. At least it seems like there are no changes.

Installed the Azure CLI and function-tools as suggested and installed Hexa globally with

npm install --global @manekinekko/hexa

It is an Nrwl/Nx workspace with an Angular application. Running the hexa init command runs all questions without any errors except the public directory question. Running with the debug flag it prints the following

 ██╗  ██╗ ███████╗ ██╗  ██╗  █████╗  
 ██║  ██║ ██╔════╝ ╚██╗██╔╝ ██╔══██╗ 
 ███████║ █████╗    ╚███╔╝  ███████║ 
 ██╔══██║ ██╔══╝    ██╔██╗  ██╔══██║ 
 ██║  ██║ ███████╗ ██╔╝ ██╗ ██║  ██║ 
 ╚═╝  ╚═╝ ╚══════╝ ╚═╝  ╚═╝ ╚═╝  ╚═╝ 


  hexa checking project file hexa.json. Found=true +0ms
? Configuration file found. Do you want to override it? Yes
? Enter a name for the project: felixlemke
  init saving project name felixlemke +0ms
  hexa updating workspace with {"project":"felixlemke"} +6s
  hexa reading file hexa.json +0ms
  hexa saving workspace with {"project":"felixlemke","subscription":{"name":"Free Trial"},"storage":{"name":"felixlemkea954","location":"westeurope"},"resourceGroup":{"location":"westeurope","name":"felixlemke"}} +1ms
  init found previous subscriptions [{"id":"4e954b68-..........","name":"Free Trial","state":"Enabled"}] +18ms
? Choose features you want to setup: Hosting
  init Configuring resource-group: +11s
  hexa az group create -l westeurope -n felixlemke --tag "x-created-by=hexa" --query "{name:name
, id:id, location:location}" --output json --verbose +11s
INFO: command ran in 1.983 seconds.
{
  "id": "/subscriptions/4e954b68-........../resourceGroups/felixlemke",
  "location": "westeurope",
  "name": "felixlemke"
}
  hexa stderr INFO: command ran in 1.983 seconds.
 +3s
  hexa stdout {
  "id": "/subscriptions/4e954b68-........../resourceGroups/felixlemke",
  "location": "westeurope",
  "name": "felixlemke"
}
 +0ms
  hexa updating workspace with {"resourceGroup":{"id":"/subscriptions/4e954b68-........../resourceGroups/felixlemke","location":"westeurope","name":"felixlemke"}} +14ms
  hexa reading file hexa.json +0ms
  hexa saving workspace with {"resourceGroup":{"location":"westeurope","name":"felixlemke"},"project":"felixlemke","subscription":{"name":"Free Trial"},"storage":{"name":"felixlemkea954","location":"westeurope"}} +0ms
  init Configuring storage: +3s
  storage Using subscription Free Trial +0ms
  storage Using resource group felixlemke +0ms
  hexa az storage account list --resource-group "felixlemke" --subscription "4e954b68-.........." --query "[].{name:name, id:id, location:location, tags:tags}" --output json --verbose +3ms
INFO: command ran in 0.746 seconds.
[
  {
    "id": "/subscriptions/4e954b68-........../resourceGroups/felixlemke/providers/Microsoft.Storage/storageAccounts/felixlemkea954",
    "location": "westeurope",
    "name": "felixlemkea954",
    "tags": {
      "x-created-by": "hexa"
    }
  }
]
  hexa stderr INFO: command ran in 0.746 seconds.
 +1s
  hexa stdout [
  {
    "id": "/subscriptions/4e954b68-........../resourceGroups/felixlemke/providers/Microsoft.Storage/storageAccounts/felixlemkea954",
    "location": "westeurope",
    "name": "felixlemkea954",
    "tags": {
      "x-created-by": "hexa"
    }
  }
]
 +0ms
  storage found one storage account felixlemkea954 +1s
  storage using storage account felixlemkea954 +0ms
  storage setting storage account felixlemkea954 +0ms
  hexa updating workspace with {"storage":{"id":"/subscriptions/4e954b68-........../resourceGroups/felixlemke/providers/Microsoft.Storage/storageAccounts/felixlemkea954","name":"felixlemkea954"}} +13ms
  hexa reading file hexa.json +0ms
  hexa saving workspace with {"storage":{"name":"felixlemkea954","location":"westeurope"},"resourceGroup":{"location":"westeurope","name":"felixlemke"},"project":"felixlemke","subscription":{"name":"Free Trial"}} +0ms
  init Configuring hosting: +1s
? Enter public folder (will be created if not present): (./public)   hexa created directory ./public +15s
? Enter public folder (will be created if not present): ./public
  hosting selected hosting folder=./public, overrideHtml=undefined, override404=undefined. overrideError=undefined +0ms
  hexa copying template file src=/Users/felixlemke/.nvm/versions/node/v10.15.3/lib/node_modules/@manekinekko/hexa/build/templates/init/hosting/index.html.tpl, destination=./public/index.html +2ms
✗ Error: ENOENT: no such file or directory, copyfile '/Users/felixlemke/.nvm/versions/node/v10.15.3/lib/node_modules/@manekinekko/hexa/build/templates/init/hosting/index.html.tpl' -> './public/index.html'
✗ Abort.

I've tested it with the build directory ./dist/apps/felixlemke-dev instead of the default ./public folder but with no success neither. It created the hexa.json file with the following content:

{
  "storage": {
    "name": "felixlemkea954",
    "location": "westeurope"
  },
  "resourceGroup": {
    "location": "westeurope",
    "name": "felixlemke"
  },
  "project": "felixlemke",
  "subscription": {
    "name": "Free Trial"
  }
}

If I run the deploy command then, it prints in debug mode

  hexa checking project file hexa.json. Found=true +0ms
  hexa reading file hexa.json +2ms
✔ Application felixlemke deployed successfully!

✔ Done in 0 seconds.

On Azure it does not change anything and the deploy URL shows the initial page https://felixlemke.azurewebsites.net/

Expected behavior

It should deploy the Angular build files (including index.html, main-.js, common-.js, ...) to Azure websites.

Desktop:

  • OS: Mac OS Catalina 10.15.1
  • Browser: Brave
  • Version: Version 1.1.20 Chromium: 79.0.3945.74 (Official Build) (64-bit)
@manekinekko
Copy link
Owner

Thank you for reporting this. I will make sure to fix this asap.

In the meantime, as a workaround, you can edit the hexa.json and manually update the hosting.folder entry as the following:

{
  ///...
  "hosting": {
    "folder": "./dist/apps/felixlemke-dev"
  }
}

Then run hexa deploy.

@ngfelixl
Copy link
Author

ngfelixl commented Dec 13, 2019

That was quick, thank you! At least it does not complete without an error now

✔ Deploying hosting felixlemke...
(node:75072) UnhandledPromiseRejectionWarning: ERROR: The specified container does not exist. Er
rorCode: ContainerNotFound
<?xml version="1.0" encoding="utf-8"?><Error><Code>ContainerNotFound</Code><Message>The specified container does not exist.
RequestId:174c09d3-501e-00cb-45db-b1525c000000
Time:2019-12-13T17:37:10.3421536Z</Message></Error>

(node:75072) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:75072) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I think the requestId should equal the other debug outputs 4e954b68-..., shouldn't it? Here is a screenshot of my Azure account

Screenshot 2019-12-13 at 18 43 29

@manekinekko
Copy link
Owner

The requestId is just a correlatio ID used by the underlying Azure CLI.

Ok, so I guess the hexa init command ended with a failure and didn't create the required storage container (because the public folder wasn't correct). This should be fixed in the next iteration.

BTW, I am working on a fix right now. I just validated my fix and have deployed an Nx app here: https://nxexamples16056.z6.web.core.windows.net/

image

I need to do more testing (with all possible combinations of flags) and I will publish a release this weekend.

@ngfelixl
Copy link
Author

Awesome! Thank you! When it's done I will try it again and tell you my experience. But from what I guess, if one is already familiar with Azure, it is a matter of minutes deploying with Hexa. Is it possible or recommended to use it for CI/CD?

@manekinekko
Copy link
Owner

So Hexa, for now, depends on the Azure CLI and the Func CLI, so if you have these dependencies installed on your CI, then yes, you can use hexa to deploy.

@manekinekko
Copy link
Owner

manekinekko commented Dec 14, 2019

Hi @ngfelixl I just release version 1.3.0 which fixes your issue. Please give it a shot and let me know. You might need to delete your existing hexa.json file before using v1.3.0 since the file format has changed a bit.

https://github.com/manekinekko/hexa/releases/tag/1.3.0

@ngfelixl
Copy link
Author

Hi @manekinekko, it works, even without deleting the existing hexa.json. One tiny remark, it is a bit confusing that it asked to replace the index.html and I didn't know why. I would prefer either not to have it, or to give a reason what it is for. For the rest: It could not be easier! Love it!

@manekinekko
Copy link
Owner

Good feedback. In fact, by default, Hexa creates an index.html, error.html and 404.html when enabling static site hosting. This is done to comply with the Azure docs. But, after thinking about it, I also find it confusing. I am going to disable that for now until I find a better way.

Glad it works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants