Reputation: 615
I have an issue that appears others have had in the past which is after deploying an Azure Function Node TypeScript v4 app, the functions are not found.
I have read the following existing Stack Overflow issues and followed their advice but my deployment is still not working.
My deployed folder looks like this:
|─ dist/**/*
|─ node_modules/**/*
├─ host.json
└─ package.json
Here is my host.json
contents:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
}
}
Here is my package.json
contents:
{
"name": "quodsi_data_connector_lucidchart_v1",
"version": "1.0.0",
"description": "",
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"clean": "rimraf dist",
"prestart": "npm run clean && npm run build",
"start": "func start",
"test": "echo \"No tests yet...\""
},
"dependencies": {
"@azure/batch": "^12.0.0",
"@azure/functions": "^4.0.0",
"@azure/storage-blob": "^12.26.0",
"@lifeomic/attempt": "^3.1.0",
"axios": "^1.7.9",
"lucid-extension-sdk": "^0.0.263",
"papaparse": "^5.5.2"
},
"devDependencies": {
"@types/node": "^20.x",
"@types/papaparse": "^5.3.15",
"copyfiles": "^2.4.1",
"rimraf": "^5.0.0",
"typescript": "^4.0.0"
},
"main": "dist/src/{index.js,functions/*.js}"
}
dist\src\functions
contains 6 different function files where each one
export async function dataConnectorHttpTrigger(request: HttpRequest, context: InvocationContext): Promise<HttpResponseInit> {
....
app.http('dataConnector', {
methods: ['GET', 'POST', 'OPTIONS'],
authLevel: 'anonymous',
route: 'dataConnector/{name}', // matches /api/dataConnector/someValue
handler: dataConnectorHttpTrigger
});
I have deployed using both the VS Code Function extension as well as the CLI. Here is my .funcignore contents:
*.js.map
*.ts
.git*
.vscode
__azurite_db*__.json
__blobstorage__
__queuestorage__
local.settings.json
test
tsconfig.json
I followed one of the answers and did this to my rg and func app without success:
az functionapp config appsettings set --name <FUNCTION_APP_NAME> \
--resource-group <RESOURCE_GROUP_NAME> \
--settings AzureWebJobsFeatureFlags=EnableWorkerIndexing
If I create a new function app and then copy and paste all my files into the new function app and deploy, the functions show up.
If I change that codebase and try to deploy a 2nd time or more, the functions disappear.
I am debating using Azure Function v3 in hopes that deployment is more consistent. Alternatively, is there a better way of deploying that is more consistent?
Upvotes: -1
Views: 20