{"action":"opened","issue":{"url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/issues/29791","repository_url":"https://api.github.com/repos/MicrosoftDocs/azure-docs","labels_url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/issues/29791/labels{/name}","comments_url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/issues/29791/comments","events_url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/issues/29791/events","html_url":"https://github.com/MicrosoftDocs/azure-docs/issues/29791","id":435583870,"node_id":"MDU6SXNzdWU0MzU1ODM4NzA=","number":29791,"title":"If statement never reached, instance never created","user":{"login":"philemon33","id":5710468,"node_id":"MDQ6VXNlcjU3MTA0Njg=","avatar_url":"https://avatars0.githubusercontent.com/u/5710468?v=4","gravatar_id":"","url":"https://api.github.com/users/philemon33","html_url":"https://github.com/philemon33","followers_url":"https://api.github.com/users/philemon33/followers","following_url":"https://api.github.com/users/philemon33/following{/other_user}","gists_url":"https://api.github.com/users/philemon33/gists{/gist_id}","starred_url":"https://api.github.com/users/philemon33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philemon33/subscriptions","organizations_url":"https://api.github.com/users/philemon33/orgs","repos_url":"https://api.github.com/users/philemon33/repos","events_url":"https://api.github.com/users/philemon33/events{/privacy}","received_events_url":"https://api.github.com/users/philemon33/received_events","type":"User","site_admin":false},"labels":[{"id":1049557287,"node_id":"MDU6TGFiZWwxMDQ5NTU3Mjg3","url":"https://api.github.com/repos/MicrosoftDocs/azure-docs/labels/azure-functions/svc","name":"azure-functions/svc","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-04-22T03:17:04Z","updated_at":"2019-04-22T03:17:05Z","closed_at":null,"author_association":"NONE","body":"In the code: \n// Check if an instance with the specified ID already exists.\n    const existingInstance = await client.getStatus(instanceId);\n    if (!existingInstance) {\n        // An instance with the specified ID doesn't exist, create one.\n        const eventData = req.body;\n        await client.startNew(functionName, instanceId, eventData);\n        context.log(`Started orchestration with ID = '${instanceId}'.`);\n        return client.createCheckStatusResponse(req, instanceId);\n    } else {\n        // An instance with the specified ID exists, don't create one.\n        return {\n            status: 409,\n            body: `An instance with ID '${instanceId}' already exists.`,\n        };\n    }\n\nisn't it rigth that the orchestrator can never be created ? The getStatus function is preceded by await, which means a Promise is returned, and existingInstance will never be null. Am I missing something ?\n\n---\n#### Document Details\n\n⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*\n\n* ID: a5d6badc-f611-71ad-b167-aabfb95dc13f\n* Version Independent ID: db5c72cb-648c-5009-7261-1ba55703c08e\n* Content: [Singletons for Durable Functions - Azure](https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-singletons#feedback)\n* Content Source: [articles/azure-functions/durable/durable-functions-singletons.md](https://github.com/Microsoft/azure-docs/blob/master/articles/azure-functions/durable/durable-functions-singletons.md)\n* Service: **azure-functions**\n* GitHub Login: @cgillum\n* Microsoft Alias: **azfuncdf**"}}
{"actor":{"display_login":"philemon33"}}