Merge pull request #77 from Azure/peolivei/global-var-patch

Fix unintended global variable issue
This commit is contained in:
peolivei2 2024-04-22 11:19:17 -07:00 коммит произвёл GitHub
Родитель 906b655ae2 c718fc9494
Коммит 60b3cc052e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -111,7 +111,7 @@ async function getDeviceHub(context, device) {
const sasToken = await getRegistrationSasToken(context, deviceId);
url = `https://${registrationHost}/${context.idScope}/registrations/${deviceId}/register?api-version=${registrationApiVersion}`;
const registrationUrl = `https://${registrationHost}/${context.idScope}/registrations/${deviceId}/register?api-version=${registrationApiVersion}`;
const registrationOptions = {
method: 'PUT',
headers: { 'Content-Type': 'application/json', Authorization: sasToken },
@ -120,13 +120,13 @@ async function getDeviceHub(context, device) {
try {
context.log('[HTTP] Initiating device registration');
const response = await fetch(url, registrationOptions).then(res => res.json());
const response = await fetch(registrationUrl, registrationOptions).then(res => res.json());
if (response.status !== 'assigning' || !response.operationId) {
throw new Error('Unknown server response');
}
url = `https://${registrationHost}/${context.idScope}/registrations/${deviceId}/operations/${response.operationId}?api-version=${registrationApiVersion}`;
const statusUrl = `https://${registrationHost}/${context.idScope}/registrations/${deviceId}/operations/${response.operationId}?api-version=${registrationApiVersion}`;
const statusOptions = {
method: 'GET',
headers: { Authorization: sasToken }
@ -138,7 +138,7 @@ async function getDeviceHub(context, device) {
await new Promise(resolve => setTimeout(resolve, registrationStatusQueryTimeout));
context.log('[HTTP] Querying device registration status');
const statusResponse = await fetch(url, statusOptions).then(res => res.json());
const statusResponse = await fetch(statusUrl, statusOptions).then(res => res.json());
if (statusResponse.status === 'assigning') {
continue;

Просмотреть файл

@ -17,7 +17,7 @@ To use the device bridge solution, you will need the following:
- An Azure account. You can create a free Azure account from [here](https://aka.ms/aft-iot).
- An Azure IoT Central application to connect the devices. Create a free app by following [these instructions](https://docs.microsoft.com/azure/iot-central/quick-deploy-iot-central).
[![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fiotc-device-bridge%2Fmaster%2Fazuredeploy.json)
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fiotc-device-bridge%2Fmaster%2Fazuredeploy.json)
## Instructions
For detailed instructions on how to deploy and configure the device bridge, see [Use the IoT Central device bridge to connect other IoT clouds to IoT Central](https://docs.microsoft.com/en-us/azure/iot-central/core/howto-build-iotc-device-bridge).
@ -31,7 +31,7 @@ Function. You can check the integrity of the code being deployed by verifying th
of the `iotc-bridge-az-function.zip` file in the root of this repository matches the following:
```
0988532d85ffc8d84c1c6c65d6edd5744ed2c695af8b9481172c705d542b5af7
22dcf01e985a16d9a9500a382da9f022fe65cacb6b5945e844ab10ec326827d3
```
# Contributing

Двоичные данные
iotc-bridge-az-function.zip

Двоичный файл не отображается.