Azure / azure-functions-pack

Easily package your Node.js Functions for Azure Functions
MIT License
153 stars 31 forks source link

Publish function within the .funcpack directory #76

Open lifan0127 opened 6 years ago

lifan0127 commented 6 years ago

According to the documentation, we can use the --copyToOutput flag to copy all needed files to the .funcpack directory and then publish from there. It gives the following example:

funcpack pack -c .
cd .funcpack  # <-- why?
func azure functionapp publish <myapp>

However when I tried this approach, it still published the entire parent directory to Azure instead of the content in .funcpack only. Is it the right behavior? Then why we need to publish within .funcpack?

My steps:

  1. Created a new function app called func-test
  2. Created a new TimerTrigger function
  3. Ran pack & publish as shown above
Publish <path>\func-test contents to an Azure Function App. Locally deleted files are not removed from destination.
Getting site publishing info...
Creating archive for current directory...
Uploading archive...
Upload completed successfully.

When I created a host.json file in the .funcpack directory and published again, it attempted to publish from .funcpack but failed due to Error calling sync triggers:

Getting site publishing info...
Creating archive for current directory...
Uploading archive...
Error calling sync triggers (InternalServerError).
Retry: 1 of 2
Creating archive for current directory...
Uploading archive...
Error calling sync triggers (InternalServerError).
Retry: 2 of 2
Creating archive for current directory...
Uploading archive...
Error calling sync triggers (InternalServerError).
bedej commented 6 years ago

I see the same behavior for your step 1-3. The function is uploaded, but it's the original version of the function app, not the packed version - looking in the portal, the .funcpack folder does not appear to have been uploaded.

Version information: Azure Functions Core Tools (2.0.1-beta.24) Function Runtime Version: 2.0.11587.0 funcpack -V: 1.0.0