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

How to check the status of a Function #299

Open
kin0992 opened this issue Sep 12, 2024 · 0 comments
Open

How to check the status of a Function #299

kin0992 opened this issue Sep 12, 2024 · 0 comments

Comments

@kin0992
Copy link

kin0992 commented Sep 12, 2024

I have a function app using the @azure/functions npm package version 4.5.1, with the following triggers defined:

app.http('info', {
  methods: ['GET'],
  authLevel: 'anonymous',
  handler: <info-handler-function>,
  route: 'info',
});

app.cosmosDB('consumer', {
  connection: 'ConsumerConnection',
  databaseName: <database-name>,
  containerName: <container-name>,
  leaseContainerName: <lease-container-name>,
  leaseContainerPrefix: <lease-container-prefix>,
  handler: <consumer-handler-function>,
});

If I omit the ConsumerConnection environment variable and run the app, the function still works (e.g., the HTTP endpoints respond) even if the consumer trigger is not properly configured.
When running locally and removing ConsumerConnection from the local.settings.json file, the function still works but logs this message:

Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.consumer'. Microsoft.Azure.WebJobs.Extensions.CosmosDB:  
Cannot create container information for <container-name> in database <database-name> with lease <lease-container-name> in database <database-name> : 
Cosmos DB connection configuration 'ConsumerConnection' does not exist. Make sure that it is a defined App Setting. 
Microsoft.Azure.WebJobs.Extensions.CosmosDB: Cosmos DB connection configuration 'ConsumerConnection' does not exist. 
Make sure that it is a defined App Setting.

My goal is to return a 500 error on the /info endpoint if there are issues (like with the cosmosDB trigger). Is there a method within the nodejs-sdk that exposes the status of a function?

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

No branches or pull requests

1 participant