"Request is missing a Bearer or PoP token." with Client token

Package Name:  @azure/keyvault-secrets
Package Version:  "^4.1.0"
Operating system: Windows 10
[ ] nodejs

version:  14.8.0

[ ] browser

name/version:  Chrome/84.0.4147.135

[ ] typescript

version: "^3.9.6"

Is the bug related to documentation in

[ ] README.md
[ ] source code documentation
[ ] SDK API docs on https://docs.microsoft.com

Describe the bug
Access Azure Key Vault from Gatsby/React app
Initiate access with
        this.keyVaultUri = `https://${keyVaultName}.vault.azure.net`;
        const credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
        this.keyVaultClient = new SecretClient(this.keyVaultUri, credential);

Get a specific secret lke
    get GoogleMapApiKey() {
        return (async () => await this.keyVaultClient.getSecret('GoogleMapApiKey'));
    }

Get the secret value like:
        const mapsKey:KeyVaultSecret = await keyVault.GoogleMapApiKey();
        setGoogleMapsApiKey(mapsKey.value ?? '' );

To Reproduce
Steps to reproduce the behavior: Illustrated in the description
Expected behavior
Should retrieve the secret from the Azure Key Vault.
Additional context
This seems related to #9005. This is a Gatsby React app. I am using TypeScript.

@KevinBurton Hello, Kevin!
Kevin, we need your help. Are you running this in a browser with web security enabled? The Key Vault service doesn't currently allow CORS requests, meaning that, if you're running this in a browser with web security enabled (which is the default behavior of most browsers), the Key Vault service won't be able to answer.
In any case, I am most interested in the exact error log. I don't see right away how the steps you're describing relate with the title you used for this issue: "Request is missing a Bearer or PoP token." with Client token.
What is the exact error you're getting?
Thank you for your time, we appreciate it.

It seems like I am getting a combination of a CORS error and a
authorization failed message:
[image: image.png]
If I am seeing these errors all stemming from the CORS error then my
question still stands. How do I connect the static web app (Gatsby React)
to my Azure Key Vault?
Thank you.
Kevin
On Tue, Aug 25, 2020 at 11:29 AM Daniel Rodríguez<EMAIL_ADDRESS>wrote:

@KevinBurton https://github.com/KevinBurton Hello, Kevin!
Kevin, we need your help. Are you running this in a browser with web
security enabled? The Key Vault service doesn't currently allow CORS
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS requests,
meaning that, if you're running this in a browser with web security enabled
(which is the default behavior of most browsers), the Key Vault service
won't be able to answer.
In any case, I am most interested in the exact error log. I don't see
right away how the steps you're describing relate with the title you used
for this issue: "Request is missing a Bearer or PoP token." with Client
token.
What is the exact error you're getting?
Thank you for your time, we appreciate it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Azure/azure-sdk-for-js/issues/10828#issuecomment-680132773,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAUFM3XBT3VDVMU6QSOJ7P3SCPRFPANCNFSM4QKQB2IA
.

@KevinBurton Hello, Mr Burton!
I am unable to load that picture, but I believe I understand anyway. You want to run the Key Vault libraries for TypeScript from a browser, using Gatsby React.
Unfortunately, we are unable to provide support for the browser yet, since the Azure Key Vault service hasn't implemented browser support.
Even though our code does work in the browsers, it only does so without web security, and only for the purposes of testing. By the time the Key Vault service officially releases support for CORS requests, we will be ready to ship a version working for the browsers.
Please let us know if that answers your question.

Thank you for your response. This answers a lot of questions. But I still
have two questions. One, If a web app is deployed in App Service then it is
still a web app and browsers access it. Are you saying that even an App
Service web app cannot access the Key Vault? Two, is there any workaround
in the meantime that my Gatsby web app can get secrets stored in the key
vault?
Regards.
On Tue, Aug 25, 2020 at 3:44 PM Daniel Rodríguez<EMAIL_ADDRESS>wrote:

@KevinBurton https://github.com/KevinBurton Hello, Mr Burton!
I am unable to load that picture, but I believe I understand anyway. You
want to run the Key Vault libraries for TypeScript from a browser, using
Gatsby React.
Unfortunately, we are unable to provide support for the browser yet, since
the Azure Key Vault service hasn't implemented browser support.
Even though our code does work in the browsers, it only does so without
web security, and only for the purposes of testing. By the time the Key
Vault service officially releases support for CORS requests, we will be
ready to ship a version working for the browsers.
Please let us know if that answers your question.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Azure/azure-sdk-for-js/issues/10828#issuecomment-680260298,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAUFM3Q7BOKYR3KLXCFS73DSCQPD7ANCNFSM4QKQB2IA
.

@KevinBurton
Hi! Perhaps this will help: If you're able to run the Key Vault clients from NodeJS, it should work flawlessly.
Would that be viable with your stack?
App Services can work with NodeJS, so that should be ok too.
It's my understanding that Gatsby React is a front-end framework, so I'm guessing it doesn't run in the NodeJS runtime at least. Please correct me if I'm wrong.
There's a work-around for CORS calls, by using proxies. I believe this could help: https://www.gatsbyjs.com/docs/api-proxy/ I'll ask around to see where I can get more information.

I n setting up there apparently is a gatsby-config.js that gets run with
NodeJs. The problem I am running there is that getting secrets from Azure
Key Vault seems to be Promise / asynchronous based.
I will read more about proxies.
On Wed, Aug 26, 2020 at 7:41 AM Daniel Rodríguez<EMAIL_ADDRESS>wrote:

@KevinBurton https://github.com/KevinBurton
Hi! Perhaps this will help: If you're able to run the Key Vault clients
from NodeJS, it should work flawlessly.
Would that be viable with your stack?
App Services can work with NodeJS, so that should be ok too.
It's my understanding that Gatsby React is a front-end framework, so I'm
guessing it doesn't run in the NodeJS runtime at least. Please correct me
if I'm wrong.
There's a work-around for CORS calls, by using proxies. I believe this
could help: https://www.gatsbyjs.com/docs/api-proxy/ I'll ask around to
see where I can get more information.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Azure/azure-sdk-for-js/issues/10828#issuecomment-680854338,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAUFM3UHNYYP7G5URGHTGMLSCT7FTANCNFSM4QKQB2IA
.

@KevinBurton Now that I see that gatsby-config.js, I think I am getting a different idea of what might be happening.
Perhaps this can help.
I see that you have the following in your code:
get GoogleMapApiKey() {
  return (async () => await this.keyVaultClient.getSecret('GoogleMapApiKey'));
}

then this:
const mapsKey:KeyVaultSecret = await keyVault.GoogleMapApiKey();
setGoogleMapsApiKey(mapsKey.value ?? '' );

There are many ways to approach this. I'll start with one. Let's call this one "avoiding getters", not because getters are bad, but because it might be clearer to work without them in this case.
Avoiding getters
The idea with this approach is to avoid having get GoogleMapApiKey as a getter. Getters are used as properties, and not as functions. I'll give you more info after the approach.
You try the following changes to eliminate the getter:
// 1. Let's change this to be a normal function, not a getter, not an asynchronous function.
getGoogleMapApiKey() {
  // 2. This then changes to return the promise of the asynchronous `getSecret`.
  //    We can work with this promise by itself.
  return this.keyVaultClient.getSecret('GoogleMapApiKey'));
}

// Then, in the code that uses getGoogleMapApiKey

// 3. getGoogleMapApiKey is now a normal function that returns a promise. We can use await in that case, as follows:
async myAsyncrhonousFunction() {
  // Depending on your Node version, await calls might not work in the global scope.
  // Which is why I'm making the function myAsyncrhonousFunction.
  const secret = await keyVault.getGoogleMapApiKey();
  console.log(secret); // Yo should be able to see the secret at this point.
}
// We still need to call myAsyncrhonousFunction somewhere.

More about getters and setters
So, please pardon me if I am explaining too much, but the reason why the getter in this case is unexpected is because a getter is usually used as if it was a property, and not a function, and even less an asynchronous function. As follows:
// Let's imagine we wanted to have an object called truck, as follows:
const truck = {

  // Now, imagine that we can't get the brand of the truck immediately,
  // because we need to make a database operation.
  // So, we can't do simply:
  //
  //     brand: "Mercedes",
  //
  // We have to use a function, in this scenario.
  // For this scenario, let's imagine that the brand comes from an environment variable,
  // or just some external source, but for now: process.env.TRUCK_BRAND can work.
  // However, we want to still provide an API that reads as if it was a static property.
  // That's when the getter shines.
  get brand() {
    return process.env.TRUCK_BRAND;
  }
};

// Then one can read the brand as follows:
console.log(truck.brand);
// See that we didn't have to use the parenthesis, because it is treated as a property.

Getters and setters usually work with a separate entity, let's imagine another source of state. Perhaps you come from this mindset from other languages. So, let's imagine the following scenario:
let stateProvider = {
  availableBrands: ["Mercedes"]
};

let truck = {
  get brand() {
    // In this case, the brand getter only gets the last property in the stateProvider.availableBrands array.
    return stateProviders.availableBrands[stateProviders.availableBrands.length - 1];
  }
  set brand(brandName) {
    // The setter then adds a property to this array.
    stateProviders.availableBrands.push(brandName);
  }
};

// Now, we can read and write the brand of the truck as follows:
console.log(truck.brand); // Should output: "Mercedes".
truck.brand = "Ford"; // Should write to the stateProvider.availableBrands array.
console.log(truck.brand); // Should output: "Ford".
console.log(stateProvider.availableBrands); // Should output: ["Mercedes", "Ford"].

In JavaScript, at least, getters and setters are not supposed to work with asynchronous calls, so the following is not possible:
let truck = {
  // Syntax error
  get async brand() {}
  // Also syntax error
  async get brand() {}
}

However, you can return a promise, then deal with the promise separately:
// Let's imagine we have a class called AsyncAPI, with a method called asyncCall() that returns a promise.
const myAsyncApi = new AsyncAPI();

let truck = {
  get brand() {
    // now we can use the getter to return a promise
    return myAsyncApi.asyncCall()
  }
}

// We then can read the brand property as a property, get the promise, then treat the promise as a promise
truck.brand.then(function callback(result) {
  console.log(result);
});

// We can also make a separate async method to read from this promise using async/await
async brandReader() {
  return await truck.brand;
}

// Which we also can use without async/await:
brandReader().then(function callback(result) {
  console.log(result);
});

Now another approach, just with async/await functions:
Async/await functions everywhere
// 1. Let's change this to be a normal function, not a getter, but indeed an asynchronous function.
async getGoogleMapApiKey() {
  // In case you need to work with the secret before returning, you would do as follows:
  //
  //    let secret = await this.keyVaultClient.getSecret('GoogleMapApiKey'));
  //    // Then we would do something here.
  //    // Then we can return:
  //    return secret;
  //
  // 2. However, since Asynchronous functions don't need to await for promises inside of them,
  //    We can instead just return the promise of the asynchronous `getSecret`.
  return this.keyVaultClient.getSecret('GoogleMapApiKey'));
}

// Then, in the code that uses getGoogleMapApiKey....

// 3. getGoogleMapApiKey is now an asynchronous function. We can use await in that case, as follows:
async myAsyncrhonousFunction() {
  // Depending on your Node version, await calls might not work in the global scope.
  // Which is why I'm making the function myAsyncrhonousFunction.
  const secret = await keyVault.getGoogleMapApiKey();
  console.log(secret); // Yo should be able to see the secret at this point.
}
// We still need to call myAsyncrhonousFunction somewhere.

Let me know if any of those methods helped!
Also, please let me know if this wasn't a good direction. We can take our time investigating the approaches. No rush!

I can see removing the getter if it makes it clearer. The getter in this
case is just returning a function that returns a Promise (hence the
await).  Since the ultimate goal of gatsby-config.js is to export
“configuration” it seems to me that somehow I need to turn this
asynchronous call to a synchronous call?
On Wed, Aug 26, 2020 at 11:03 AM Daniel Rodríguez<EMAIL_ADDRESS>wrote:

@KevinBurton https://github.com/KevinBurton Now that I see that
gatsby-config.js, I think I am getting a different idea of what might be
happening.
Perhaps this can help.
I see that you have the following in your code:
get GoogleMapApiKey() {
return (async () => await this.keyVaultClient.getSecret('GoogleMapApiKey'));
}
then this:
const mapsKey:KeyVaultSecret = await keyVault.GoogleMapApiKey();
setGoogleMapsApiKey(mapsKey.value ?? '' );
There are many ways to approach this. I'll start with one. Let's call this
one "avoiding getters", not because getters are bad, but because it might
be clearer to work without them in this case.
Avoiding getters
The idea with this approach is to avoid having get GoogleMapApiKey as a
getter. Getters are used as properties, and not as functions. I'll give you
more info after the approach.
You try the following changes to eliminate the getter:
// 1. Let's change this to be a normal function, not a getter, not an asynchronous function.
getGoogleMapApiKey() {
// 2. This then changes to return the promise of the asynchronous getSecret.
//    We can work with this promise by itself.
return this.keyVaultClient.getSecret('GoogleMapApiKey'));
}
// Then, in the code that uses getGoogleMapApiKey
// 3. getGoogleMapApiKey is now a normal function that returns a promise. We can use await in that case, as follows:
async myAsyncrhonousFunction() {
// Depending on your Node version, await calls might not work in the global scope.
// Which is why I'm making the function myAsyncrhonousFunction.
const secret = await keyVault.getGoogleMapApiKey();
console.log(secret); // Yo should be able to see the secret at this point.
}
// We still need to call myAsyncrhonousFunction somewhere.
More about getters and setters
So, please pardon me if I am explaining too much, but the reason why the
getter in this case is unexpected is because a getter is usually used as if
it was a property, and not a function, and even less an asynchronous
function. As follows:
// Let's imagine we wanted to have an object called truck, as follows:
const truck = {
// Now, imagine that we can't get the brand of the truck immediately,
// because we need to make a database operation.
// So, we can't do simply:
//
//     brand: "Mercedes",
//
// We have to use a function, in this scenario.
// For this scenario, let's imagine that the brand comes from an environment variable,
// or just some external source, but for now: process.env.TRUCK_BRAND can work.
// However, we want to still provide an API that reads as if it was a static property.
// That's when the getter shines.
get brand() {
return process.env.TRUCK_BRAND;

}
};
// Then one can read the brand as follows:
console.log(truck.brand);
// See that we didn't have to use the parenthesis, because it is treated as a property.
Getters and setters usually work with a separate entity, let's imagine
another source of state. Perhaps you come from this mindset from other
languages. So, let's imagine the following scenario:
let stateProvider = {
availableBrands: ["Mercedes"]
};
let truck = {
get brand() {
// In this case, the brand getter only gets the last property in the stateProvider.availableBrands array.

return stateProviders.availableBrands[stateProviders.availableBrands.length - 1];

}
set brand(brandName) {
// The setter then adds a property to this array.

stateProviders.availableBrands.push(brandName);

}
};
// Now, we can read and write the brand of the truck as follows:
console.log(truck.brand); // Should output: "Mercedes".
truck.brand = "Ford"; // Should write to the stateProvider.availableBrands array.
console.log(truck.brand); // Should output: "Ford".
console.log(stateProvider.availableBrands); // Should output: ["Mercedes", "Ford"].
In JavaScript, at least, getters and setters are not supposed to work with
asynchronous calls, so the following is not possible:
let truck = {
// Syntax error
get async brand() {}
// Also syntax error
async get brand() {}
}
However, you can return a promise, then deal with the promise separately:
// Let's imagine we have a class called AsyncAPI, with a method called asyncCall() that returns a promise.
const myAsyncApi = new AsyncAPI();
let truck = {
get brand() {
// now we can use the getter to return a promise

return myAsyncApi.asyncCall()

}
}
// We then can read the brand property as a property, get the promise, then treat the promise as a promise
truck.brand.then(function callback(result) {
console.log(result);
});
// We can also make a separate async method to read from this promise using async/await
async brandReader() {
return await truck.brand;
}
// Which we also can use without async/await:
brandReader().then(function callback(result) {
console.log(result);
});

Now another approach, just with async/await functions:
Async/await functions everywhere
// 1. Let's change this to be a normal function, not a getter, but indeed an asynchronous function.
async getGoogleMapApiKey() {
// In case you need to work with the secret before returning, you would do as follows:
//
//    let secret = await this.keyVaultClient.getSecret('GoogleMapApiKey'));
//    // Then we would do something here.
//    // Then we can return:
//    return secret;
//
// 2. However, since Asynchronous functions don't need to await for promises inside of them,
//    We can instead just return the promise of the asynchronous getSecret.
return this.keyVaultClient.getSecret('GoogleMapApiKey'));
}
// Then, in the code that uses getGoogleMapApiKey....
// 3. getGoogleMapApiKey is now an asynchronous function. We can use await in that case, as follows:
async myAsyncrhonousFunction() {
// Depending on your Node version, await calls might not work in the global scope.
// Which is why I'm making the function myAsyncrhonousFunction.
const secret = await keyVault.getGoogleMapApiKey();
console.log(secret); // Yo should be able to see the secret at this point.
}
// We still need to call myAsyncrhonousFunction somewhere.

Let me know if any of those methods helped!
Also, please let me know if this wasn't a good direction. We can take our
time investigating the approaches. No rush!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Azure/azure-sdk-for-js/issues/10828#issuecomment-680972178,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAUFM3TXDAW7FHZROFWSVLLSCUW3TANCNFSM4QKQB2IA
.

@KevinBurton oh that also helped me! Thank you.
So far, I'm understanding that you have a gatsby-config.js where you're trying to use KeyVault-Secrets.
Do you mind sharing more of your gatsby-config.js? I want to see more clearly where you're retrieving the secret.
The latest NodeJS version (or at least above 14.3.0) does support top-level await, so you could retrieve your secret in your gatsby-config.js before returning the configuration object, something like this:
// Imagine this is your gatsby-config.js

// You declare the KeyVault client first.

// Then you retrieve the secret at the top-level, no functions needed:
const secret = await keyVaultClient.getSecret('GoogleMapApiKey');

// Then you proceed with your gatsby-config.js, where you can use that secret as many times as you need.
// ...

Would that help?
Please share more information about your gatsby-config.json if that doesn't help.

Thank you for your help.
Here is my gatsby-config.js
const { ClientSecretCredential } = require("@azure/identity");
const { SecretClient } = require("@azure/keyvault-secrets");
require("dotenv").config({
path: .env.${process.env.NODE_ENV},
})
const KVUri = https://${process.env.AZURE_KEY_VAULT_NAME}.vault.azure.net;
const credential = new ClientSecretCredential(process.env.AZURE_TENANT_ID,
process.env.AZURE_CLIENT_ID,
process.env.
AZURE_CLIENT_SECRET);
const client = new SecretClient(KVUri, credential);
async function getSecrets() {
let keyVaultSecrets = {
'auth0Domain': '',
'auth0ClientId': '',
'auth0Secret': '',
'recaptchaSiteKey': '',
'recaptchaSecretKey': '',
'googleMapsApiKey': '',
'wodifyUser': '',
'wodifyPassword': ''
};
const KVUri = https://${process.env.AZURE_KEY_VAULT_NAME}.vault.azure.net ;
const credential = new ClientSecretCredential(process.env.AZURE_TENANT_ID
,
process.env.AZURE_CLIENT_ID,
process.env.
AZURE_CLIENT_SECRET);
const client = new SecretClient(KVUri, credential);
let retrievedSecret;
retrievedSecret = await client.getSecret('Auth0Domain');
keyVaultSecrets.auth0Domain = retrievedSecret.value;
retrievedSecret = await client.getSecret('Auth0ClientId');
keyVaultSecrets.auth0ClientId = retrievedSecret.value;
retrievedSecret = await client.getSecret('Auth0Secret');
keyVaultSecrets.auth0Secret = retrievedSecret.value;
retrievedSecret = await client.getSecret('RecaptchaSiteKey');
keyVaultSecrets.recaptchaSiteKey = retrievedSecret.value;
retrievedSecret = await client.getSecret('RecaptchaSecretKey');
keyVaultSecrets.recaptchaSecretKey = retrievedSecret.value;
retrievedSecret = await client.getSecret('GoogleMapsApiKey');
keyVaultSecrets.googleMapsApiKey = retrievedSecret.value;
process.env.GOOGLE_MAPS_API_KEY = keyVaultSecrets.googleMapsApiKey;
retrievedSecret = await client.getSecret('WodifyUser');
keyVaultSecrets.wodifyUser = retrievedSecret.value;
retrievedSecret = await client.getSecret('WodifyPassword');
keyVaultSecrets.wodifyPassword = retrievedSecret.value;
console.log(keyVaultSecrets);
return keyVaultSecrets;
}
let config = {
siteMetadata: {
title: Great State Strength and Conditioning,
description: Great State web page,
author: @KevinBurton,
auth0Domain: '',
auth0ClientId: '',
auth0Secret: '',
recaptchaSiteKey: '',
recaptchaSecretKey: '',
googleMapsApiKey: '',
wodifyUser: '',
wodifyPassword: ''
},
plugins: [
gatsby-plugin-react-helmet,
{
resolve: gatsby-source-filesystem,
options: {
name: images,
path: ${__dirname}/src/assets,
},
},
gatsby-plugin-styled-components,
gatsby-transformer-sharp,
gatsby-plugin-sharp,
gatsby-plugin-material-ui,
gatsby-plugin-sass,
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// gatsby-plugin-offline,
],
};
getSecrets();
module.exports = config;
The problem is that the export doesn't seem to wait for the asynchronous
call to resolve before returning. Lets just focus on the googMapsApiKey. If
I put a literal string for the value that is exported it seems to work. But
what I want is the value resolved in the Promise. NOTE: There are no
getters here that I have control over.
Kevin
On Wed, Aug 26, 2020 at 11:35 AM Daniel Rodríguez<EMAIL_ADDRESS>wrote:

@KevinBurton https://github.com/KevinBurton oh that also helped me!
Thank you.
So far, I'm understanding that you have a gatsby-config.js where you're
trying to use KeyVault-Secrets.
Do you mind sharing more of your gatsby-config.js? I want to see more
clearly where you're retrieving the secret.
The latest NodeJS version (or at least above 14.3.0) does support
top-level await, so you could retrieve your secret in your gatsby-config.js
before returning the configuration object, something like this:
// Imagine this is your gatsby-config.js
// You declare the KeyVault client first.
// Then you retrieve the secret at the top-level, no functions needed:
const secret = await keyVaultClient.getSecret('GoogleMapApiKey');
// Then you proceed with your gatsby-config.js, where you can use that secret as many times as you need.
// ...
Would that help?
Please share more information about your gatsby-config.json if that
doesn't help.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Azure/azure-sdk-for-js/issues/10828#issuecomment-680990575,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAUFM3VY5VGESC57SFGEULTSCU2TLANCNFSM4QKQB2IA
.

By the way I am using node v14.8.0, I am not sure what needs to change to
support this asynchronous feature?
On Wed, Aug 26, 2020 at 11:42 AM Kevin Burton<EMAIL_ADDRESS>wrote:

Thank you for your help.
Here is my gatsby-config.js
const { ClientSecretCredential } = require("@azure/identity");
const { SecretClient } = require("@azure/keyvault-secrets");
require("dotenv").config({
path: .env.${process.env.NODE_ENV},
})
const KVUri = https://${process.env.AZURE_KEY_VAULT_NAME}.vault.azure.net ;
const credential = new ClientSecretCredential(process.env.AZURE_TENANT_ID
,
process.env.AZURE_CLIENT_ID,
process.env.
AZURE_CLIENT_SECRET);
const client = new SecretClient(KVUri, credential);
async function getSecrets() {
let keyVaultSecrets = {
'auth0Domain': '',
'auth0ClientId': '',
'auth0Secret': '',
'recaptchaSiteKey': '',
'recaptchaSecretKey': '',
'googleMapsApiKey': '',
'wodifyUser': '',
'wodifyPassword': ''
};
const KVUri = https://${process.env.AZURE_KEY_VAULT_NAME}. vault.azure.net;
const credential = new ClientSecretCredential(process.env.
AZURE_TENANT_ID,
process.env.
AZURE_CLIENT_ID,
process.env.
AZURE_CLIENT_SECRET);
const client = new SecretClient(KVUri, credential);
let retrievedSecret;
retrievedSecret = await client.getSecret('Auth0Domain');
keyVaultSecrets.auth0Domain = retrievedSecret.value;
retrievedSecret = await client.getSecret('Auth0ClientId');
keyVaultSecrets.auth0ClientId = retrievedSecret.value;
retrievedSecret = await client.getSecret('Auth0Secret');
keyVaultSecrets.auth0Secret = retrievedSecret.value;
retrievedSecret = await client.getSecret('RecaptchaSiteKey');
keyVaultSecrets.recaptchaSiteKey = retrievedSecret.value;
retrievedSecret = await client.getSecret('RecaptchaSecretKey');
keyVaultSecrets.recaptchaSecretKey = retrievedSecret.value;
retrievedSecret = await client.getSecret('GoogleMapsApiKey');
keyVaultSecrets.googleMapsApiKey = retrievedSecret.value;
process.env.GOOGLE_MAPS_API_KEY = keyVaultSecrets.googleMapsApiKey;
retrievedSecret = await client.getSecret('WodifyUser');
keyVaultSecrets.wodifyUser = retrievedSecret.value;
retrievedSecret = await client.getSecret('WodifyPassword');
keyVaultSecrets.wodifyPassword = retrievedSecret.value;
console.log(keyVaultSecrets);
return keyVaultSecrets;
}
let config = {
siteMetadata: {
title: Great State Strength and Conditioning,
description: Great State web page,
author: @KevinBurton,
auth0Domain: '',
auth0ClientId: '',
auth0Secret: '',
recaptchaSiteKey: '',
recaptchaSecretKey: '',
googleMapsApiKey: '',
wodifyUser: '',
wodifyPassword: ''
},
plugins: [
gatsby-plugin-react-helmet,
{
resolve: gatsby-source-filesystem,
options: {
name: images,
path: ${__dirname}/src/assets,
},
},
gatsby-plugin-styled-components,
gatsby-transformer-sharp,
gatsby-plugin-sharp,
gatsby-plugin-material-ui,
gatsby-plugin-sass,
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// gatsby-plugin-offline,
],
};
getSecrets();
module.exports = config;
The problem is that the export doesn't seem to wait for the asynchronous
call to resolve before returning. Lets just focus on the googMapsApiKey. If
I put a literal string for the value that is exported it seems to work. But
what I want is the value resolved in the Promise. NOTE: There are no
getters here that I have control over.
Kevin
On Wed, Aug 26, 2020 at 11:35 AM Daniel Rodríguez <
<EMAIL_ADDRESS>wrote:

@KevinBurton https://github.com/KevinBurton oh that also helped me!
Thank you.
So far, I'm understanding that you have a gatsby-config.js where you're
trying to use KeyVault-Secrets.
Do you mind sharing more of your gatsby-config.js? I want to see more
clearly where you're retrieving the secret.
The latest NodeJS version (or at least above 14.3.0) does support
top-level await, so you could retrieve your secret in your gatsby-config.js
before returning the configuration object, something like this:
// Imagine this is your gatsby-config.js
// You declare the KeyVault client first.
// Then you retrieve the secret at the top-level, no functions needed:
const secret = await keyVaultClient.getSecret('GoogleMapApiKey');
// Then you proceed with your gatsby-config.js, where you can use that secret as many times as you need.
// ...
Would that help?
Please share more information about your gatsby-config.json if that
doesn't help.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Azure/azure-sdk-for-js/issues/10828#issuecomment-680990575,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAUFM3VY5VGESC57SFGEULTSCU2TLANCNFSM4QKQB2IA
.

@KevinBurton ok ok! That gives me enough information to help you, I believe.
Let's keep up this pace. I'll give you a quick answer, in the form of steps to follow:

Declare config outside of getSecrets. Just let config = {} helps.
In getSecrets, you don't need to re-declare config, you can do config = { /* your object */ without let, var or const. The idea is that we will be writing over the top-level config. We could do better than this, but as a step towards the solution, this might be good enough for now.
Now, where you call getSecrets(), place an await before the call, as in await getSecrets(). I'm assuming this will work. I'll give it a try after posting this, just in case.

After that, config should be populated before it's sent to module.exports. You can try debugging it or logging some portion of it to see if you're able to see what you are expecting.
I'm ready to answer again, Mr Burton!

@KevinBurton alright, for the top level await, I had to add this property and value to my package.json:
  "type": "module",

After that I was able to run the code I sent you with the top-level await. I hope that helps!

So now gatsby-config looks like:
const { ClientSecretCredential } = require("@azure/identity");
const { SecretClient } = require("@azure/keyvault-secrets");
require("dotenv").config({
path: .env.${process.env.NODE_ENV},
})
const KVUri = https://${process.env.AZURE_KEY_VAULT_NAME}.vault.azure.net;
const credential = new ClientSecretCredential(process.env.AZURE_TENANT_ID,
process.env.AZURE_CLIENT_ID,
process.env.
AZURE_CLIENT_SECRET);
const client = new SecretClient(KVUri, credential);
async function getSecrets() {
let keyVaultSecrets = {
'auth0Domain': '',
'auth0ClientId': '',
'auth0Secret': '',
'recaptchaSiteKey': '',
'recaptchaSecretKey': '',
'googleMapsApiKey': '',
'wodifyUser': '',
'wodifyPassword': ''
};
const KVUri = https://${process.env.AZURE_KEY_VAULT_NAME}.vault.azure.net ;
const credential = new ClientSecretCredential(process.env.AZURE_TENANT_ID
,
process.env.AZURE_CLIENT_ID,
process.env.
AZURE_CLIENT_SECRET);
const client = new SecretClient(KVUri, credential);
let retrievedSecret;
retrievedSecret = await client.getSecret('Auth0Domain');
keyVaultSecrets.auth0Domain = retrievedSecret.value;
retrievedSecret = await client.getSecret('Auth0ClientId');
keyVaultSecrets.auth0ClientId = retrievedSecret.value;
retrievedSecret = await client.getSecret('Auth0Secret');
keyVaultSecrets.auth0Secret = retrievedSecret.value;
retrievedSecret = await client.getSecret('RecaptchaSiteKey');
keyVaultSecrets.recaptchaSiteKey = retrievedSecret.value;
retrievedSecret = await client.getSecret('RecaptchaSecretKey');
keyVaultSecrets.recaptchaSecretKey = retrievedSecret.value;
retrievedSecret = await client.getSecret('GoogleMapsApiKey');
keyVaultSecrets.googleMapsApiKey = retrievedSecret.value;
process.env.GOOGLE_MAPS_API_KEY = keyVaultSecrets.googleMapsApiKey;
retrievedSecret = await client.getSecret('WodifyUser');
keyVaultSecrets.wodifyUser = retrievedSecret.value;
retrievedSecret = await client.getSecret('WodifyPassword');
keyVaultSecrets.wodifyPassword = retrievedSecret.value;
// console.log(keyVaultSecrets);
return keyVaultSecrets;
}
const keyVaultSecrets = await getSecrets();
let config = {
siteMetadata: {
title: Great State Strength and Conditioning,
description: Great State web page,
author: @KevinBurton,
},
plugins: [
gatsby-plugin-react-helmet,
{
resolve: gatsby-source-filesystem,
options: {
name: images,
path: ${__dirname}/src/assets,
},
},
gatsby-plugin-styled-components,
gatsby-transformer-sharp,
gatsby-plugin-sharp,
gatsby-plugin-material-ui,
gatsby-plugin-sass,
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// gatsby-plugin-offline,
],
};
module.exports = config;
Adding
"author": "Kevin Burton<EMAIL_ADDRESS>"type": "module",
"dependencies": {
to package.json. But now I get
yarn start
yarn run v1.22.4
$ yarn run develop
$ gatsby develop
internal/process/esm_loader.js:74
internalBinding('errors').triggerUncaughtException(
^
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for
C:\Users\RKevi\source\repos\GreatState-gatsby.cache\tmp-30928-4nOKL4bzTny6
at Loader.defaultGetFormat [as _getFormat]
(internal/modules/esm/get_format.js:65:15)
at Loader.getFormat (internal/modules/esm/loader.js:101:42)
at Loader.getModuleJob (internal/modules/esm/loader.js:230:31)
at async Loader.import (internal/modules/esm/loader.js:164:17)
at async Object.loadESM (internal/process/esm_loader.js:68:5) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this
command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this
command.
If I take the "type":"module" out of package.json I get
For help, see: https://nodejs.org/en/docs/inspector
ERROR #10123  CONFIG
We encountered an error while trying to load your site's gatsby-config.
Please fix the error and try again.
Error: C:\Users\RKevi\source\repos\GreatState-gatsby\gatsby-config.js:55
const keyVaultSecrets = await getSecrets();
^^^^^
SyntaxError: await is only valid in async function

v8-compile-cache.js:226 NativeCompileCache._moduleCompile

On Wed, Aug 26, 2020 at 12:04 PM Daniel Rodríguez<EMAIL_ADDRESS>wrote:

@KevinBurton https://github.com/KevinBurton alright, for the top level
await, I had to add this property and value to my package.json:
"type": "module",
After that I was able to run the code I sent you with the top-level await.
I hope that helps!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Azure/azure-sdk-for-js/issues/10828#issuecomment-681006345,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAUFM3QHGUKLKGF4QW6MFALSCU57NANCNFSM4QKQB2IA
.

@KevinBurton Ok, I like that update! I think we're getting closer. Here's an idea, continuing from what you have updated:
Instead of getting all the secrets at once, assign only the promise, with the following change:
- const keyVaultSecrets = await getSecrets();
+ const secretsPromise = getSecrets();

Then, I'm assuming you are using keyVaultSecrets from a plugin, or something like a function. If that function is an asynchronous function, you can do the following:
  async myFunction() {
    const secrets = await secretsPromise;
    // Then you can use the secrets
  }

If that function isn't an asynchronous function, you can use the promises syntax:
  myFunction(callback) {
    secretsPromise.then(function (secrets) {
      // Here you can use the secrets.
      // In this case, at some point you will need to use something like a callback that you will receive to indicate that you're done.
      callback(); // We're done here.
    });
  }

Let me know if that is feasible!

Oops I forgot to add in the secrets to the config.
siteMetadata: {
title: Great State Strength and Conditioning,
description: Great State web page,
author: @KevinBurton,
...keyVaultSecrets
},
Kevin
On Wed, Aug 26, 2020 at 12:15 PM Kevin Burton<EMAIL_ADDRESS>wrote:

So now gatsby-config looks like:
const { ClientSecretCredential } = require("@azure/identity");
const { SecretClient } = require("@azure/keyvault-secrets");
require("dotenv").config({
path: .env.${process.env.NODE_ENV},
})
const KVUri = https://${process.env.AZURE_KEY_VAULT_NAME}.vault.azure.net ;
const credential = new ClientSecretCredential(process.env.AZURE_TENANT_ID
,
process.env.AZURE_CLIENT_ID,
process.env.
AZURE_CLIENT_SECRET);
const client = new SecretClient(KVUri, credential);
async function getSecrets() {
let keyVaultSecrets = {
'auth0Domain': '',
'auth0ClientId': '',
'auth0Secret': '',
'recaptchaSiteKey': '',
'recaptchaSecretKey': '',
'googleMapsApiKey': '',
'wodifyUser': '',
'wodifyPassword': ''
};
const KVUri = https://${process.env.AZURE_KEY_VAULT_NAME}. vault.azure.net;
const credential = new ClientSecretCredential(process.env.
AZURE_TENANT_ID,
process.env.
AZURE_CLIENT_ID,
process.env.
AZURE_CLIENT_SECRET);
const client = new SecretClient(KVUri, credential);
let retrievedSecret;
retrievedSecret = await client.getSecret('Auth0Domain');
keyVaultSecrets.auth0Domain = retrievedSecret.value;
retrievedSecret = await client.getSecret('Auth0ClientId');
keyVaultSecrets.auth0ClientId = retrievedSecret.value;
retrievedSecret = await client.getSecret('Auth0Secret');
keyVaultSecrets.auth0Secret = retrievedSecret.value;
retrievedSecret = await client.getSecret('RecaptchaSiteKey');
keyVaultSecrets.recaptchaSiteKey = retrievedSecret.value;
retrievedSecret = await client.getSecret('RecaptchaSecretKey');
keyVaultSecrets.recaptchaSecretKey = retrievedSecret.value;
retrievedSecret = await client.getSecret('GoogleMapsApiKey');
keyVaultSecrets.googleMapsApiKey = retrievedSecret.value;
process.env.GOOGLE_MAPS_API_KEY = keyVaultSecrets.googleMapsApiKey;
retrievedSecret = await client.getSecret('WodifyUser');
keyVaultSecrets.wodifyUser = retrievedSecret.value;
retrievedSecret = await client.getSecret('WodifyPassword');
keyVaultSecrets.wodifyPassword = retrievedSecret.value;
// console.log(keyVaultSecrets);
return keyVaultSecrets;
}
const keyVaultSecrets = await getSecrets();
let config = {
siteMetadata: {
title: Great State Strength and Conditioning,
description: Great State web page,
author: @KevinBurton,
},
plugins: [
gatsby-plugin-react-helmet,
{
resolve: gatsby-source-filesystem,
options: {
name: images,
path: ${__dirname}/src/assets,
},
},
gatsby-plugin-styled-components,
gatsby-transformer-sharp,
gatsby-plugin-sharp,
gatsby-plugin-material-ui,
gatsby-plugin-sass,
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// gatsby-plugin-offline,
],
};
module.exports = config;
Adding
"author": "Kevin Burton<EMAIL_ADDRESS>"type": "module",
"dependencies": {
to package.json. But now I get
yarn start
yarn run v1.22.4
$ yarn run develop
$ gatsby develop
internal/process/esm_loader.js:74
internalBinding('errors').triggerUncaughtException(
^
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for
C:\Users\RKevi\source\repos\GreatState-gatsby.cache\tmp-30928-4nOKL4bzTny6
at Loader.defaultGetFormat [as _getFormat]
(internal/modules/esm/get_format.js:65:15)
at Loader.getFormat (internal/modules/esm/loader.js:101:42)
at Loader.getModuleJob (internal/modules/esm/loader.js:230:31)
at async Loader.import (internal/modules/esm/loader.js:164:17)
at async Object.loadESM (internal/process/esm_loader.js:68:5) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about
this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about
this command.
If I take the "type":"module" out of package.json I get
For help, see: https://nodejs.org/en/docs/inspector
ERROR #10123  CONFIG
We encountered an error while trying to load your site's gatsby-config.
Please fix the error and try again.
Error: C:\Users\RKevi\source\repos\GreatState-gatsby\gatsby-config.js:55
const keyVaultSecrets = await getSecrets();
^^^^^
SyntaxError: await is only valid in async function

v8-compile-cache.js:226 NativeCompileCache._moduleCompile

On Wed, Aug 26, 2020 at 12:04 PM Daniel Rodríguez <
<EMAIL_ADDRESS>wrote:

@KevinBurton https://github.com/KevinBurton alright, for the top level
await, I had to add this property and value to my package.json:
"type": "module",
After that I was able to run the code I sent you with the top-level
await. I hope that helps!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Azure/azure-sdk-for-js/issues/10828#issuecomment-681006345,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAUFM3QHGUKLKGF4QW6MFALSCU57NANCNFSM4QKQB2IA
.

@KevinBurton would it be possible to provide a function for your code instead of adding the secrets as part of the configuration object? I haven't gotten deeper in Gatsby, but I'm guessing you can provide some form of method that can be used by the rest of the program, rather than just config properties. This will give us a lot more flexibility on the possible answers.
If you absolutely can't use a method/function and must use configuration properties, like the siteMetadata one, please let me know. We can think of something.
The sensible approach seemed to be to use plugins, or at least as I am searching through the Gatsby docs.
This issue might be relevant: https://github.com/gatsbyjs/gatsby/issues/11128

Now my gatsby-config.js looks like:
const { ClientSecretCredential } = require("@azure/identity");
const { SecretClient } = require("@azure/keyvault-secrets");
require("dotenv").config({
path: .env.${process.env.NODE_ENV},
})
const KVUri = https://${process.env.AZURE_KEY_VAULT_NAME}.vault.azure.net;
const credential = new ClientSecretCredential(process.env.AZURE_TENANT_ID,
process.env.AZURE_CLIENT_ID,
process.env.
AZURE_CLIENT_SECRET);
const client = new SecretClient(KVUri, credential);
async function getSecrets() {
let keyVaultSecrets = {
'auth0Domain': '',
'auth0ClientId': '',
'auth0Secret': '',
'recaptchaSiteKey': '',
'recaptchaSecretKey': '',
'googleMapsApiKey': '',
'wodifyUser': '',
'wodifyPassword': ''
};
const KVUri = https://${process.env.AZURE_KEY_VAULT_NAME}.vault.azure.net ;
const credential = new ClientSecretCredential(process.env.AZURE_TENANT_ID
,
process.env.AZURE_CLIENT_ID,
process.env.
AZURE_CLIENT_SECRET);
const client = new SecretClient(KVUri, credential);
let retrievedSecret;
retrievedSecret = await client.getSecret('Auth0Domain');
keyVaultSecrets.auth0Domain = retrievedSecret.value;
retrievedSecret = await client.getSecret('Auth0ClientId');
keyVaultSecrets.auth0ClientId = retrievedSecret.value;
retrievedSecret = await client.getSecret('Auth0Secret');
keyVaultSecrets.auth0Secret = retrievedSecret.value;
retrievedSecret = await client.getSecret('RecaptchaSiteKey');
keyVaultSecrets.recaptchaSiteKey = retrievedSecret.value;
retrievedSecret = await client.getSecret('RecaptchaSecretKey');
keyVaultSecrets.recaptchaSecretKey = retrievedSecret.value;
retrievedSecret = await client.getSecret('GoogleMapsApiKey');
keyVaultSecrets.googleMapsApiKey = retrievedSecret.value;
process.env.GOOGLE_MAPS_API_KEY = keyVaultSecrets.googleMapsApiKey;
retrievedSecret = await client.getSecret('WodifyUser');
keyVaultSecrets.wodifyUser = retrievedSecret.value;
retrievedSecret = await client.getSecret('WodifyPassword');
keyVaultSecrets.wodifyPassword = retrievedSecret.value;
// console.log(keyVaultSecrets);
return keyVaultSecrets;
}
let config = {};
const secretsPromise = getSecrets();
async function myFunction() {
const secrets = await secretsPromise;
config = {
siteMetadata: {
title: Great State Strength and Conditioning,
description: Great State web page,
author: @KevinBurton,
...secrets
},
plugins: [
gatsby-plugin-react-helmet,
{
resolve: gatsby-source-filesystem,
options: {
name: images,
path: ${__dirname}/src/assets,
},
},
gatsby-plugin-styled-components,
gatsby-transformer-sharp,
gatsby-plugin-sharp,
gatsby-plugin-material-ui,
gatsby-plugin-sass,
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// gatsby-plugin-offline,
],
};
}
module.exports = config;
But this also doesn't work as now the variables are not properly exported
and I get errors like
ERROR #85901  GRAPHQL
There was an error in your GraphQL query:
Unknown type "ImageSharpFixed".
GraphQL request:2:37
1 |
2 |   fragment GatsbyImageSharpFixed on ImageSharpFixed {
which says to me that the export didn't wait for the configuration.
The reason that I am putting them into the secrets into the configuration
object stems back to Azure not being able to be called on the client-side.
So the "hook" that I am using is to get the secrets server side and then
query for them on the client side.
Kevin
On Wed, Aug 26, 2020 at 12:27 PM Daniel Rodríguez<EMAIL_ADDRESS>wrote:

@KevinBurton https://github.com/KevinBurton would it be possible to
provide a function for your code instead of adding the secrets as part of
the configuration object? I haven't gotten deeper in Gatsby, but I'm
guessing you can provide some form of method that can be used by the rest
of the program, rather than just config properties. This will give us a lot
more flexibility on the possible answers.
If you absolutely can't use a method/function and must use configuration
properties, like the siteMetadata one, please let me know. We can think of
something.
The sensible approach seemed to be to use plugins, or at least as I am
searching through the Gatsby docs.
This issue might be relevant: gatsbyjs/gatsby#11128
https://github.com/gatsbyjs/gatsby/issues/11128
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Azure/azure-sdk-for-js/issues/10828#issuecomment-681018467,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAUFM3SGMYY2JHL6WRUBNZLSCVAZFANCNFSM4QKQB2IA
.

@KevinBurton Instead of adding the secrets to the metadata, another approach would be to add an endpoint from which you can retrieve the secrets. Would that be a viable approach?

@KevinBurton some Gatsby users seem to be using plugins in the configuration object to provide an asynchronous way of retrieving configuration, as shown here: https://github.com/gatsbyjs/gatsby/issues/11128#issuecomment-458609530 would that approach be viable for you?

I guess. That endpoint would have to go to its server to get the secrets. I
am not sure how this works for deploying and debugging an app.
On Wed, Aug 26, 2020 at 12:55 PM Daniel Rodríguez<EMAIL_ADDRESS>wrote:

@KevinBurton https://github.com/KevinBurton Instead of adding the
secrets to the metadata, another approach would be to add an endpoint from
which you can retrieve the secrets. Would that be a viable approach?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Azure/azure-sdk-for-js/issues/10828#issuecomment-681031999,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAUFM3S4RXDUBC5MVCIXAJTSCVD7JANCNFSM4QKQB2IA
.

@KevinBurton I might be able to dig deeper and try to deploy a Gatsby app myself later this week or next week, if that helps.

I am too new to Gatsby to understand how this all works but I will look
into it. The big hurdle for me right now is the comment "and you could
invoke that and await inside your plugin", which indicates to me that I
need to develop and use a plugin which right now I don't know how to do.
On Wed, Aug 26, 2020 at 12:57 PM Daniel Rodríguez<EMAIL_ADDRESS>wrote:

@KevinBurton https://github.com/KevinBurton some Gatsby users seem to
be using plugins in the configuration object to provide an asynchronous way
of retrieving configuration, as shown here: gatsbyjs/gatsby#11128
(comment)
https://github.com/gatsbyjs/gatsby/issues/11128#issuecomment-458609530
would that approach be viable for you?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Azure/azure-sdk-for-js/issues/10828#issuecomment-681033189,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAUFM3V4U3C24ELUMBXSWW3SCVEH3ANCNFSM4QKQB2IA
.

It would. If you have time. Thank you.
Kevin
On Wed, Aug 26, 2020 at 1:01 PM Daniel Rodríguez<EMAIL_ADDRESS>wrote:

@KevinBurton https://github.com/KevinBurton I might be able to dig
deeper and try to deploy a Gatsby app myself later this week or next week,
if that helps.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Azure/azure-sdk-for-js/issues/10828#issuecomment-681035623,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAUFM3R75THFO4ADVLSCMB3SCVEZDANCNFSM4QKQB2IA
.

@KevinBurton that's a good spot to be in! So many things to learn! Alright, good luck with that study!
If you happen to find the solution before me, please report back.
I'll put some time over the weekend trying to deploy a Gatsby App using Azure App Service and our KeyVault clients to see if I can come up with something else.
I'm also asking internally in case somebody else knows more than me about this.
In case none of us has a better answer soon, see you in some days! good luck!

One more thought for which I have NO experience is to add Azure function to
the app. Since it is already being deployed to static web site on Azure
this seems like a natural place to put a function?
Again thank you for the help.
Kevin
On Wed, Aug 26, 2020 at 1:05 PM Daniel Rodríguez<EMAIL_ADDRESS>wrote:

@KevinBurton https://github.com/KevinBurton that's a good spot to be
in! So many things to learn! Alright, good luck with that study!
If you happen to find the solution before me, please report back.
I'll put some time over the weekend trying to deploy a Gatsby App using
Azure App Service and our KeyVault clients to see if I can come up with
something else.
I'm also asking internally in case somebody else knows more than me about
this.
In case none of us has a better answer soon, see you in some days! good
luck!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Azure/azure-sdk-for-js/issues/10828#issuecomment-681037320,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAUFM3XCCTFI5CIADUNDFS3SCVFFZANCNFSM4QKQB2IA
.

@KevinBurton I'll add an Azure Function to the mix when I get to work with this!

@KevinBurton We might have an update for this issue later this year. For now we're pretty busy. I hope things are good on your side!

Hey @KevinBurton and @sadasant,
Thanks for the great discussion here. We will be continuing the efforts in #12967 at the end of which we hope to have some guidance around using Key Vault in web apps.


Fix issue #81: Broken kv_cache

Fix for kv_cache Issues (#81)
Summary
This PR addresses three critical issues in the kv_cache implementation that affected forecast accuracy:

Cache Reset Error: Fixed incorrect self.y_cache flag resetting, ensuring global reset across the model.
Causal Attention Error: When using kv_cache, currently the attention is computed using F.scaled_dot_product_attention with  non-causal attention (is_causal=True). This was changed to use causal attention for the first time step before the cache is initialised, since in the first time step of kv_cache attettion is computed for all tokens because the cache hasn't been initialised yet.
Broken Rotary Embeddings: Adjusted the sequence length calculation post-concatenation with kv_cache for correct rotary positional embeddings.

Review Request
Kindly review the modifications and confirm their effectiveness on your end.

@kashif What I meant with "working with the full sequence" was that even during inference, you still take in the full context e.g. 128 time steps, and compute all their keys and values. Then if using kv_cache, for following time steps you take in just the last token, not the full sequence, as opposed to no kv-cache, where you take in the full sequence at each time step (full 128-step context + the new tokens you generated).
Since training was done with causal attention, switching to non-causal attention in inference changes behaviour and thus changes results. You can test this yourself by setting is_causal=Falseat all points - it leads to a clear change in results. I'm still not 100% on why non-causal attention would matter if we're only chopping off the last prediction, but it clearly affects the results.

Thanks @KelianM for the contribution! Much appreciated!
If you could add an update at the top of the README mentioning the changes (eg. X was broken, and is now fixed leading to better performance on Y), that would be great. (Please also add that it's a contribution by you)!

Thanks @KelianM for the contribution! Much appreciated!
If you could add an update at the top of the README mentioning the changes (eg. X was broken, and is now fixed leading to better performance on Y), that would be great. (Please also add that it's a contribution by you)!

Sure I can do that, will just need to make another PR for that though since this has been merged already.


logs: fix tagged logs macros for inline usage

Additional Description: in case ENVOY_TAGGED_STREAM_LOG_TO_LOGGER and ENVOY_TAGGED_CONN_LOG_TO_LOGGER are used with inline tags, e.g., ENVOY_TAGGED_CONN_LOG(info, (std::map<std::string, std::string>{{"key_inline", "val"}}), connection_, "fake message"), the printed log will only include tags from the inline map, and will not include the connection/stream ID tags. The PR fixes this so both the inline tags as well as the connection/stream ID are included in the output tags.
Risk Level: low
Testing: unit tests
Docs Changes: None
Release Notes: None
Platform Specific Features: None

Ping @yanavlasov


KDE partition manager does not work

Describe the bug
KDE Partition Manager runs but it does not show any disks and nothing inside of its GUI works.
Steps To Reproduce
Steps to reproduce the behavior:

Install partition-manager package.
Run it under a normal user or a superuser.

Expected behavior
It should work.
Additional context
Here's the command line output when you run partitionmanager, maybe something in it is relevant:
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Loaded backend plugin:  "pmsfdiskbackendplugin"
Installation might be wrong, we can't locate `org.kde.kpmcore.externalcommand.policy` on the polkit actions folder.
Please check if your Installation is on a different prefix and copy it to /usr/share/polkit-1/actions
That's specified for your distro. Since this is distro specific, you need to look at your distribution documentation.
QWidget::setMinimumSize: (MessageWidgetDock/QDockWidget) Negative sizes (0,-1) are not possible
QWidget::setMaximumSize: (MessageWidgetDock/QDockWidget) Negative sizes (0,-1) are not possible

Notify maintainers

Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.68, NixOS, 22.05 (Quokka), 22.05.3632.78a37aa630f`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.8.1`
 - channels(root): `"nixos-22.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Did you install it via programs.partition-manager.enable?

Nope, just dumped it into environment.systemPackages. Enabling it the way you described works. Thank you.
I guess the question now is can it be made to work when dumped into systemPackages? Gparted works fine that way IIRC. Like how would you discover that you have to install it with programs.partition-manager.enable?

Dang I got got my this as well, thanks for the solution, really wish there was some kind of guard against this kind of thing though.

I guess the question now is can it be made to work when dumped into systemPackages?

It easily because it requires a running service.

Like how would you discover that you have to install it with programs.partition-manager.enable?

Right now you need to know that but that's a general issue being tracked in nixos-search repo.

Weird, even enabling security.polkit doesn't fix the issue, nor does manually adding the packages to systemPackages. Is there some other config I'm missing here? (program still can't locate the polkit action)

Looming at the option, it needs:
services.dbus.packages = [ pkgs.libsForQt5.kpmcore ];

It requires the following:
services.dbus.packages = [ pkgs.libsForQt5.kpmcore ];
# `kpmcore` need to be installed to pull in polkit actions.
environment.systemPackages = [ pkgs.libsForQt5.kpmcore pkgs.partition-manager ];

Yes, I’ve tried both enabling the module and adding both packages to systemPackages and the one to dbus, but they still result in the program not detecting any drives and the same error from the terminal.

Applying programs.partition-manager.enable = true to my configuration.nix allowed the partitionmanager to complete it's startup and show devices.
Not sure this should be closed though; end user expectation is if a package installs it's going to work; at a minimum there should be a warning or something that tells me additional manual configuration will be required.   Silently failing and have to google for this issue to know why isn't really cool.

end user expectation is if a package installs it's going to work

Then we must better document that if there is a options under programs, you most likely want to use that instead. Unfortunately I don't know where the best place would be to put this or how to tackle this problem.

I suggested concerned packages to give the indication about the corresponding option in longDescription, such as solaar indicates appropriate option in longDescription

See https://github.com/NixOS/nixpkgs/pull/222397

Installing via programs.partition-manager.enable = true; didn't solve it for me. I used to get the same issue OP described, at this point it just segfaults.
If more options are required, it's still not documented anywhere.

The installation instructions here https://search.nixos.org/packages?channel=22.11&show=partition-manager&from=0&size=50&sort=relevance&type=packages&query=partition still say

How to install partition-manager?
Add the following Nix code to your NixOS Configuration, usually located in /etc/nixos/configuration.nix
  environment.systemPackages = [
    pkgs.partition-manager
  ];

Yes and that will not change in near future because it is auto generated by the search page. If you see the instructions above, there are more instructions. Also 22.11 didn't get the backport and won't get it because it is near EOL.

Installing via programs.partition-manager.enable = true; didn't solve it for me. I used to get the same issue OP described, at this point it just segfaults.
If more options are required, it's still not documented anywhere.

No, there shouldn't be more required. Please try restarting to see if that fixes maybe some qt problems or so.

Thanks.
I had no idea at all that the version of nix I installed a week ago is near EOL.
I'll get back to you if the problem recurs after I upgrade (probably wont do so for a while)


CSP subscriptions?

Please can you confirm if Management Groups are supported for CSP subscriptions? I don't see them listed in the CSP supported services list at https://docs.microsoft.com/en-us/azure/cloud-solution-provider/overview/azure-csp-available-services

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: 1527b80e-5270-b5f0-9034-747c6f92ae4e
Version Independent ID: 50b9882c-dcb0-ecc1-241b-1361ad2fff1e
Content: Organize your resources with Azure management groups
Content Source: articles/azure-resource-manager/management-groups-overview.md
Service: azure-resource-manager
GitHub Login: @rthorn17
Microsoft Alias: rithorn

@jtuliani Thanks for the feedback! I have assigned the issue to the content author to evaluate and update as appropriate.

From my quick test, I see that Management Groups are supported in CSP subscriptions.
I do, however, think that they're not as useful when it comes to the CSP model. If you, like me, have a number of CSP subscriptions from different customers to manage, you'll find that the AzureAD tenant is the Management Group boundary (makes sense come to think of it ;) ).
In the CSP model, each of the customers has a different AAD tenant, so I can't create a global Management Group which would allow me to set the same Policies and RBAC on all the subscriptions.

Thanks for confirming they work!
I think they still have value. From a customer perspective, it still allows governance to be moved up from the per-subscription level. And even as a partner managing CSP subscriptions, it moves governance from the per-subscription level to the per-customer level, reducing the work.

Management Groups has been added to the list of supported services for CSP.

#please-close


feat: change viewport css property value automatically when app metrics changed.

In this demo, the scrolling list with the red rectangle was styled using CSS viewport units: vh and vw. When the app metrics information changed (keyword popup), the list view's height was automatically updated.
https://github.com/user-attachments/assets/1cb5e9a5-e462-44d0-941a-f8e3a850a9f4

OK


No login name error when installing SQLiteStudio

Version
Microsoft Windows [Version 10.0.22621.1105]
WSL Version

[X] WSL 2
[ ] WSL 1

Kernel Version
Linux version <IP_ADDRESS>-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0
Distro Version
22.04
Other Software
No response
Repro Steps

Do a fresh install of WSL2
Make sure other GUIs are working such as by installing Gedit
Now try to downloading SQLiteStudio-3.4.3-linux-x64-installer.run
Run chmod +x SQLiteStudio-3.4.3-linux-x64-installer.run
Then run sudo ./SQLiteStudio-3.4.3-linux-x64-installer.run
Select either Local user or root user when installing - doesn't matter which

Expected Behavior
The application should install normally
Actual Behavior
When the application starts to install it immediately gives a dialog box saying:
ERROR
There has been an error
Error running logname : logname: no login name
The application will exit now

It is suspected that this is due to the way that WSL logs the user into the system
Diagnostic Logs
No response

happens to me as well on linux mint

The issue is that logname command does not return the user name in glibc based Linux distributions. The SQLiteStudio installater should work in musl libc based Linux distribution (e.g. Alpine, Gentoo, Void etc.).

Any workarounds?
On Tue, Feb 28, 2023, 18:17 Biswapriyo Nath @.***>
wrote:

The issue is that logname command does not return the user name in glibc
based Linux distributions. The SQLiteStudio installater should work in musl
libc based Linux distribution (e.g. Alpine, Gentoo, Void etc.).
—
Reply to this email directly, view it on GitHub
https://github.com/microsoft/WSL/issues/9623#issuecomment-1447592759,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AC7IWC3MG6OFAILKXYSGPCDWZWC57ANCNFSM6AAAAAAUX6VNEA
.
You are receiving this because you commented.Message ID:
@.***>

⚠ Danger⚠ There could be simple workaround for this. But I can think of only one destructive workaround. Please revert the changes after the installation of SQLiteStudio.

Rename logname binary: sudo mv /usr/bin/logname /usr/bin/logname.orig
Copy whoami program as logname: sudo cp /usr/bin/whoami /usr/bin/logname
Install SQLiteStudio.
Delete /usr/bin/logname.
Rename logname.orig to logname.

Ohhh clever! Much appreciated, I'll give it a try, perhaps can be less
destructive with modifying the path for the command to a directory with the
temporary logname
On Tue, Feb 28, 2023, 19:20 Biswapriyo Nath @.***>
wrote:

⚠ Danger⚠ There could be simple workaround for this. But I can think of
only one destructive workaround. Please revert the changes after the
installation of SQLiteStudio.

Rename logname binary: sudo mv /usr/bin/logname
/usr/bin/logname.orig
Copy whoami program as logname: sudo cp /usr/bin/whoami
/usr/bin/logname
Install SQLiteStudio.
Delete /usr/bin/logname.
Rename logname.orig to logname.

—
Reply to this email directly, view it on GitHub
https://github.com/microsoft/WSL/issues/9623#issuecomment-1447649193,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AC7IWCYAO64ZRAAE7WC23SLWZWKJLANCNFSM6AAAAAAUX6VNEA
.
You are receiving this because you commented.Message ID:
@.***>

Estava quebrando a cabeça e esse tutorial me salvou, muito obrigada! Uso Linux Mint e deu certo.


[Don't merge] Investigate impact of https://github.com/apple/swift/issues/62671

This PR only exist to run the Swift CI for Linux without any changes to the code compared to main to investigate the impact of https://github.com/apple/swift/issues/62671

@swift-ci please test

@swift-ci please test

@swift-ci please test

@swift-ci please test

@swift-ci please test Linux

@swift-ci please test Linux

@swift-ci please test Linux

@swift-ci please test Linux

We'll open a new PR if we need to continue investigating this


Support for Tex-based Equation Rendering?

Hi, Yiyang,
Firstly, thanks for the excellent beauty work. It really stunned me.
Many people they use their blog for some paper review record, and the equation noting is of vital necessity.
 Does this theme template support tex-based markdown equation rendering?
If not, is there any plan for adding this feature? Looking forward to your reply.
Best,
Teng

@ter-li Thx for your suggestion. It's a good idea to add tex support. Unfortunately, I don't know how to add it to a hexo theme. Could you please tell me some other themes with this feature. I will learn and try my best to add this feature.

Thanks for your reply.
I know that the next-theme/hexo-theme-next gives several options for Math Formulas Render. Hope can help you.
Last, thanks for your open-source contributions.

@ter-li Hey bro, the next theme is really a good example. I found them using Mathjax and Katex for tex parsing and displaying. I've tried out the sdks in my localhost demo, and it did work. I'll push the update to this repo later.

BTW, there are some bugs in the theme, mainly because of the busuanzi sdk. It's loading of pv is taking time. I'll consider a better way of pv and comment counting, or just move theme out of the theme.
I'll appreciate it if you like this hexo theme.
Best wishes!


Added scanner functionality

please review my code

Fix after allow permission to load the scanner
Fix textview at the top
Fix aspect ratio


Add Graham2016&Wang2017-libs

Pull Request
This PR for Graham2016&Wang2017-libs to close issue #463 and #462
For the following list(s):

[ ] ancientmetagenome-anthropogenic (README)
[x] ancientmetagenome-environmental (README, ask @thedir-team-dirt for advice)
[ ] ancientmetagenome-hostassociated (README, ask @thedir-team-bugparty for advice)
[ ] ancientsinglegenome-hostassociated (README, ask @thedir-team-pathopeeps for advice)

Quick comment as I start the view, please one PR per publication in the future ,3


Objects or No Objects

Discussion about records vs objects

Please define the terms and they are not the same thing?

Link to potentially relevant discussion?

If you read the OOHaskell paper you will find that an object is the fixed point of a record. However I in general prefer to separate data and functions.
A record is like a namespace, and a value of a record type is a particular implementation or value. In basic terms a record is like a C struct.

@keean wrote:

If you read the OOHaskell paper you will find that an object is the fixed point of a record.

Are you referring to page 15, where setting the tail to the Unit type?
Again this seems to be a conclusion that is specific to Haskell's type system and how you are representing inheritance? And what does inheritance have to do with objects?

I think we are agreed to have simple objects. No inheritance just interfaces/type classes. Closing as decided.

You mean no virtual inheritance and no subclassing. But what about typeclass objects? And what about unions being subtypes? I don't think we can nail down those yet?

I think the conclusion here is we are having objects, which will be at least simple objects. The other things are the subject of other threads, but to cover my thoughts, I don't think we need typeclass objects because we have union types. By no inheritance I mean you cannot extend object A. You can extend a typeclass but that is something different. We have interface inheritance, but not implementation inheritance.

@shelby wrote:

I don't think we need typeclass objects because we have union types.

Disagree.


Query time is always returning as 0

Bolt driver
I am trying to time the execution of queries in Neo4j.  There was a stackoverflow post detailing how to do this, and I followed the steps for a simple query on my database.  I am getting back records, however, the time is always 0.  It also does not specify what unit the time should be in (anywhere in the limited documentation).
I run the same query on Neo4j directly and the execution time is around 1200ms.  Is there no way to get this number from the bolt connector?
Neo4j Version: 3.5.8 Community
Neo4j Mode: Single instance
Driver version: Python driver 1.7.1
Operating System: Ubuntu 18.04.2 LTS
Steps to reproduce

Start Neo4j
Connect to Neo4j using the GraphDatabase driver
Start a session and complete a transaction.
Call summary().result_available_after and summary().result_consumed_after and notice both are 0

Expected behavior
The time should be at least greater than 0
Actual behavior
The query time is 0
I can attach my code if necessary, but I essentially just followed the example posted on the stackoverflow post I mentioned.

I encounter a similar issue, although in my case the result is always None, which leaves me to wonder why it was not set correctly in the first place. The query does indeed return a valid result, though, so it is certainly not the fault of the query...

https://github.com/neo4j/neo4j-python-driver/wiki/1.7-changelog#176


there is a crash in dbscan algoritm

in my data,  row 26th will run into
https://github.com/sjwhitworth/golearn/blob/74ae077eafb245fa3bdca0288854b6d51f97fe60/clustering/dbscan.go#LL122C4-L122C4
and bit 277 will write into clustered,
and row 277 will run into
https://github.com/sjwhitworth/golearn/blob/74ae077eafb245fa3bdca0288854b6d51f97fe60/clustering/dbscan.go#L74
because row 277 has been in clustered but has not been in visited, and then crash

您好，您的邮件已收到，我会尽快查看，^_^

邮件已收到，谢谢！
                 ——赵淼

is there some body following?

邮件已收到，谢谢！
                 ——赵淼

您好，您的邮件已收到，我会尽快查看，^_^

is there some body following?

I think result is NO, the lib has 11 month not upgrade...

邮件已收到，谢谢！
                 ——赵淼


Allow to "!include" yaml files

There seems to be little reason not to allow this. Security can hardly be argued here as cabal custom setups and template haskell are far more powerful in this regard.
So anyway, here's an example of usage:
package.yaml:
# ...

tests:
    hlint: !include "../common/hlint.yaml"

hlint.yaml:
source-dirs: test
main: hlint.hs
ghc-options:
    -Wall
    -threaded
    -with-rtsopts=-N
dependencies:
    - base
    - hlint

Also, due to how Data.Yaml works, this can be abused to provide entire libraries of snippets:
package.yaml:
# if "xxx:" is used instead of a known field, a warning is emitted :-(
name: !include "../common/lib.yaml"

name: example1
version: '<IP_ADDRESS>'
synopsis: Example
<<: *legal

<<: *defaults

library:
    source-dirs: src

tests:
    hlint: *test_hlint

lib.yaml:
- &legal
    maintainer: Some One<EMAIL_ADDRESS>    copyright: (c) 2017 Some One
    license: BSD3

- &defaults
    dependencies:
        - base
        - containers
    ghc-options:
        - -Wall
        - -Werror

- &test_hlint
    source-dirs: test
    main: hlint.hs
    dependencies: [hlint]

In general, I'm open to this change.  But I would like to get some more feedback from hpack users first, just to be sure that there are no concerns.
stack includes hpack @mgsloan @snoyberg
Also @soenkehahn any comments?

@liskin Also, regarding the build failure, apparently the yaml library has different show instances depending on GHC version now?  We might need CPP to fix this.  Can you look into that too?

The build failure seems to be this: https://github.com/haskell/directory/issues/44#issuecomment-186575172
I have no idea which version of directory tinc brings in scope but it's likely the buggy one. Shall I go the #if MIN_VERSION_directory(1, 2, 3) route or can we just upgrade directory in Travis builds?

@liskin tinc tries to use the directory version that comes with GHC if possible.

@liskin if you can address the following points, I'm fine with merging this:

dig into the build failure
add documentation
as per #149 add a changelog entry

I pushed a workaround for the failing tests, but it's (unsuprisingly) a bit ugly. Maybe I should submit it to the yaml package instead. @snoyberg what do you think?

I think it makes sense for yaml.

Okay, I'll prepare a pull req there later this evening. :-)

So, here you go: https://github.com/snoyberg/yaml/pull/104
@sol But I guess we still want the workaround here as well, right? Anyway, I'll write the docs and changelog tomorrow.

@liskin If we can fix this in yaml we don't need a workaround here anymore.  I'm fine if the tests pass with the latest version of yaml
I'm willing to accept that the exception behavior will be different with older versions of yaml for the sake of code simplicity.

Okay, yaml <IP_ADDRESS> is on hackage so I dropped the ugly commit, added documentation, enhanced the changelog and added an entry for this.

Finally, green build checks! :-)

@liskin Hey, thanks for taking care of this and all the other issues that spawned from it.  I think this is a pretty awesome change.
If you can address my bikeshedding, it's good for merge.

And now the Windows build blows up when building happy. That can't be my fault, can it?

Pushed again, everything's green again.

@liskin Thanks a lot!
In general, my bandwidth is limited for medical reasons.  I try to keep up with important stuff, but I'm grateful for any help.  If you want to further help with things, then go ahead and bump the version.  Also what is your Hackage account name?

https://github.com/sol/hpack/pull/154
I'm TomasJanousek on Hackage.


Icons Fragment Not showing icons?

i have run this project on my studio and everything works fine but when i click on icon menu button it shows only empty tab with out name etc and no data in viewpager.
Can you please help me how to insert data into it?

Fill your drawable.xml with your icon list

thanks alot and sorry for my stupid question.

@danimahardhika  sorry but i think i don't have idea how to add items in drawable.xml file. and is it also add new tab in icons fragment?

Yes. That's related to Icon Pack stuff, if you don't know that, that means you don't know how to create an icon pack. Ask in community instead.

i think in previous version we have some tabs and icons already in iconsBaseFragment isn't it/

That previous version is a long time ago

i figured out how it is fetching icons can you please help me how it is creating different tabs?

Like I said before, that's related to Icon Pack stuff, not dashboard stuff.
You need to create drawable.xml to list your icons for Launcher Icon
Picker (like Nova, Apex, etc)
On Tue, Feb 6, 2018 at 3:00 PM, Muhammad Nouman<EMAIL_ADDRESS>wrote:

@danimahardhika https://github.com/danimahardhika sorry but i think i
don't have idea how to add items in drawable.xml file. and is it also add
new tab in icons fragment?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/danimahardhika/candybar-library/issues/132#issuecomment-363339354,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWESWc0df-ndjHv6JQNCNczCSCtrqyc9ks5tSATbgaJpZM4R5CIc
.

ok dear thanks for your time.


May need a better way tokenize characters...

Hello,
I recently encountered an issue while using your open source project. When I tried to use the project with Chinese characters, I received the following error message:
openai.error.InvalidRequestError: This model's maximum context length is 4097 tokens, however you requested 5803 tokens (1707 in your prompt; 4096 for the completion). Please reduce your prompt; or completion length.
I believe this issue might be due to a possible miscalculation in the token count for Chinese characters. I understand that the GPT model tokenizes text differently based on the language, and it is possible that the algorithm isn't accurately calculating the token count for Chinese text. This leads to an incorrect total token count and subsequently the InvalidRequestError.
To better diagnose and resolve this issue, I kindly request you to look into the algorithm's handling of Chinese characters, specifically in the tokenization process. It would be greatly appreciated if you could provide any guidance or potential fixes for this issue.
Thank you for your time and effort in maintaining this project. I'm looking forward to your response.

Hi @terryops ,
That is interesting! Please could you provide the sample pdf or URL so that I can replicate the scenario.

one.pdf
Please see the attachment and try to replicate.
Thanks!

Yes, I tested that the Chinese language embeddings are not working as of now. I am working on it.


Bug on defining center

I am encountering a bug when setting the items to stop in center. The center that is being chosen by the roulette is off by some pixels and can be easily seen. The bug happens on the horizontal roulette not on the vertical one and when I open the inspect on my demo page somehow the center gets fixed. Is there a way to fix this. Thank you!

I'm closing this issue due to no activity. If you have any question feel free to open a new issue.


handle a exception when the configuration is not correct

Trying vdirsyncer I made a wrong config file and I was getting some exceptions.
I added a better error message showing what could be wrong.

Hello @pierg75, thanks for your contribution!

Please remove the temporary binary file from your commit (see "files changed" tab)

Please adhere to the styleguide. Your current code has two violations:
  pip install flake8
  flake8  # throws errors

Catching KeyError around that much code is too broad IMO. Something inside collections_for_pair might raise this exception for completely unrelated reasons. I suppose the error message you got was from all_storages[a_name], so this should work:
+    try:
+        config_a, config_b = all_storages[a_name], all_storages[b_name]
+    except KeyError as e:
+        raise CliError('Pair {}: Storage {} not found. These are the '
+                       'configured storages: {}'
+                       .format(pair_name, str(e), list(all_storages)))
+
     all_collections = dict(collections_for_pair(
         general['status_path'], a_name, b_name, pair_name,
-        all_storages[a_name], all_storages[b_name], pair_options
+        config_a, config_b, pair_options
     ))

It'd be nice if the error message is consistent with the one below it.

Hi,
Indeed your suggestion works great :)
I've adjusted it based on your comment.

Thanks!

@pierg75 Please add yourself to AUTHORS.rst if you want.

Thanks, but I think I still don't deserve to be there.
Maybe later when hopefully I'll push more changes :)


feat:  add delete command to variables command tree

WHY:
Implement the functionality that allows users to delete a specific variable identified by a UUID.

I have read the CLA Document and I hereby sign the CLA


future authentication plan

build up a sign up function in Django admin website, and register the user to firebase.
build a function to give users different levels of access to the admin website after registration.

Duplicate issue on repository Admin-CANBeWell #1


running smart-live-rebuild compiles packages when there are no repo changes

hello,
when I run smart-live-rebuild, I get the folllowing error for all packages:
!!!  If possible, please confirm with the complete backtrace created using --debug option.
I will improve handling of this error but it seems that won't help you much. Does this happen to all of your live packages or only some of them? Is there anything unusual about your setup? Does the /var/db/pkg tree contain environment* files? Do you have any other package managers installed?

Hello,
this happened to all packages.
here is the debug output:
dagg@NCC-5001-D ~ $ smart-live-rebuild --debug
*** Updating the repositories using 6 parallel jobs...
Traceback (most recent call last):
  File "/usr/bin/smart-live-rebuild-2.7", line 26, in
    sys.exit(main(sys.argv))
  File "/usr/lib64/python2.7/site-packages/smartliverebuild/cli.py", line 140, in main
    packages = SmartLiveRebuild(opts, pm, cliargs = args)
  File "/usr/lib64/python2.7/site-packages/smartliverebuild/core.py", line 105, in SmartLiveRebuild
    cache = cache)
  File "/usr/lib64/python2.7/site-packages/smartliverebuild/vcs/git_2.py", line 12, in init
    RemoteVCSSupport.init(self, args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/smartliverebuild/vcs/init.py", line 72, in init
    self.env = environ.copy((self.reqenv + self.optenv))
AttributeError: 'NoneType' object has no attribute 'copy'
as for the mentioned file,
dagg@NCC-5001-D ~ $ ll /var/db/pkg/app-portage/smart-live-rebuild-1.2.1/environment.bz2
-rw-r--r-- 1 root root 33478 Nov 26 11:51 /var/db/pkg/app-portage/smart-live-rebuild-1.2.1/environment.bz2
and running man  /var/db/pkg/app-portage/smart-live-rebuild-1.2.1/environment.bz2 is possible and I can see it's content.
I only use portage, my emerge --info has all the info about my setup.
An wise Scandinavian old man once said: "in the end, everything is going to be alright"

From: Michał Górny<EMAIL_ADDRESS>To: daggs1<EMAIL_ADDRESS>Sent: Friday, December 23, 2011 10:21 AM
Subject: Re: [smart-live-rebuild] running smart-live-rebuild compiles packages when there are no repo changes (#7)
After careful analysis of the code, it seems that the only reasonable reason such thing may happen i because the environment.bz2 file is unaccessible. If possible, please confirm with the complete backtrace created using --debug option.
I will improve handling of this error but it seems that won't help you much. Does this happen to all of your live packages or only some of them? Is there anything unusual about your setup? Does the /var/db/pkg tree contain environment* files? Do you have any other package managers installed?

Reply to this email directly or view it on GitHub:
https://github.com/mgorny/smart-live-rebuild/issues/7#issuecomment-3258940

Ok, this one is going to be tough. Could you try running gentoopmq shell and typing in:
next(iter(pm.installed)).path

there you go:
dagg@NCC-5001-D ~ $ gentoopmq shell
For better user experience, install IPython.
The following objects have been imported for you:
        pm: <gentoopm.portagepm.PortagePM object at 0x7fdc2f138190>
        f: <module 'gentoopm.filters' from '/usr/lib64/python2.7/site-packages/gentoopm/filters.pyc'>
        m: <module 'gentoopm.matchers' from '/usr/lib64/python2.7/site-packages/gentoopm/matchers.pyc'>

next(iter(pm.installed)).path
u'/var/db/pkg/sys-kernel/module-rebuild-0.5'

An wise Scandinavian old man once said: "in the end, everything is going to be alright"

From: Michał Górny<EMAIL_ADDRESS>To: daggs1<EMAIL_ADDRESS>Sent: Friday, December 23, 2011 4:48 PM
Subject: Re: [smart-live-rebuild] running smart-live-rebuild compiles packages when there are no repo changes (#7)
Ok, this one is going to be tough. Could you try running gentoopmq shell and typing in:
next(iter(pm.installed)).path

Reply to this email directly or view it on GitHub:
https://github.com/mgorny/smart-live-rebuild/issues/7#issuecomment-3261478

Ok, it is really tough. I'll need you to choose one of the live (rebuildable) packages and try in gentoopmq shell:
p = pm.installed['app-foo/bar']
p.path
p.environ

Of course, substituting your package name for app-foo/bar.

dagg@NCC-5001-D ~ $ gentoopmq shell
For better user experience, install IPython.
The following objects have been imported for you:
        pm: <gentoopm.portagepm.PortagePM object at 0x7f4147046190>
        f: <module 'gentoopm.filters' from '/usr/lib64/python2.7/site-packages/gentoopm/filters.pyc'>
        m: <module 'gentoopm.matchers' from '/usr/lib64/python2.7/site-packages/gentoopm/matchers.pyc'>

p = pm.installed['x11-libs/libdrm']
p.path
u'/var/db/pkg/x11-libs/libdrm-9999'
p.environ

An wise Scandinavian old man once said: "in the end, everything is going to be alright"

From: Michał Górny<EMAIL_ADDRESS>To: daggs1<EMAIL_ADDRESS>Sent: Friday, December 23, 2011 5:59 PM
Subject: Re: [smart-live-rebuild] running smart-live-rebuild compiles packages when there are no repo changes (#7)
Ok, it is really tough. I'll need you to choose one of the live (rebuildable) packages and try in gentoopmq shell:
p = pm.installed['app-foo/bar']
    p.path
    p.environ
Of course, substituting your package name for app-foo/bar.

Reply to this email directly or view it on GitHub:
https://github.com/mgorny/smart-live-rebuild/issues/7#issuecomment-3262064

Do you, by any chance, have a file named environment in the current directory? Should be fixed in mgorny/gentoopm@750eff0.

And gentoopm-0.2.4 released. That update should fix smart-live-rebuild for you. Please reopen if the error persists.


Fix copyPixels w/ alpha

This PR attempts to make copyPixels() behave like flash on all targets (currently 99% similar, due to off-by-one values in some cases).

[cffi] I've gone with a readable impl., as moving the ifs outside and using different loops didn't seem to bring significant performance improvements (maybe branch prediction at work?!)
[html] now uses the pure haxe non-cffi copyPixels(), after creating buffers (canvas/data) for source and alpha images

ref: https://github.com/openfl/openfl/issues/910
tested with https://gist.github.com/azrafe7/85e3cf486ffe23b13102

Additional notes:

in my benchmarks flash is still slighly faster than cffi (0.001s vs 0.003s)
probably html5 could be improved as actually relies on convertToCanvas/createImageData (but it's already around 0.006s)
although my tests are passing mind that they're programmatically created BitmapDatas, so it might be wise to test further using actual pngs
also this needs the other PR about fillRect alpha to behave better (you can spot a difference in neko with transparent ON)

Oh... Travis CI is failing because initialization of alphaView is behind a conditional, but it's only used when that specific conditional is true!
I see haxe version used for CI is 3.2.1, it seems to work fine for me with 3.3.0 (git build development @ d99cb4d).
Should I fix that by guarding it with a null check?

Wow this is extremely thorough

Hey @larsiusprime, thanks.
I'm a bit rusty in c++, so would appreciate some help in passing CI and do the correct thing.
Travis is rightly complaining about ./src/graphics/utils/ImageDataUtil.cpp:163:54: error: taking address of temporary [-fpermissive].
How I should go with this? Just use new  and let GC do its work, and/or dipose the mem at the end of the function?

I'm not sure that the GC is going to kick in if you're already directly at the C++ level, I think the hxcpp GC only operates on code you write in haxe. I'm by no means a C++ expert either. Maybe ask @mauvecow or @jgranick

Yeah, Haxe's GC doesn't work on data you allocate manually in C/C++. So that alphaPoint you're allocating is a memory leak. For that, since it's not used anywhere else, you can scope a Vector2 onto that scope and then just reference that instead of allocating anything. eg
Vector2 temp;
if (alphaPoint == NULL) alphaPoint = &temp;

alphaView is a little trickier. ImageDataView doesn't appear to allocate anything itself, but it doesn't have a blank constructor and it's being taken out of scope. I think if you added a blank constructor to it, you can just ditch the pointer reference and do 'alphaView = ImageDataView (alphaImage, &alphaRect);' no problem.
If that ends up not being an option, yeah temporarily allocate and delete at function end is fine.

Thanks @mauvecow. I've gone with a temp vec for alphaPoint, and new/delete for alphaView.
I'm wondering if it would be better to just branch on needsMultiplyAlpha and use local vars instead...

Don't merge this yet!
html5 is slower than previously stated with this impl. (I was getting wrong timings as getPixel32 triggered a side effect not accounted for in the tests).

We need more people testing this but, as it is, it seems to work reliably neko/cpp.
I've reverted my changes for js, as invoking convert/create noticeably slowed down the thing. I was also getting different results for canvas/dom/webgl (canvas and dom worked but were too slow, webgl had other not-directly-related problems), and being not familiar with the differences between them I preferred to just leave js out of the PR.
The logic so far seems to be solid (needsMultiplyAlpha/needsBlending), so if anyone with more knowledge about the js target can take a shot at how to correctly implement it would be really nice (...actually I'd be really interested in following that process).

I was thinking of a faster way to do this in html5 by leveraging globalCompositeOperation, but trying to come up with a POF saw myself struggling with __srcContext/__srcCanvas/etc.
I still think the idea might be worth persuing. Some pseudocode:
  if (needsMultiplyAlpha) {
    sourceImage = sourceImage.clone(); // here we could also just clone the interested area instead of the whole bitmapData
    sourceImage.multiplyAlphaWith(alphaImage);
  }

  if (needsBlending) {
    // ensure to set globalCompositeOperation to 'source-over' so we get blending...
    destImageContext.drawImage(sourceCanvas, properOffsets/RectsArgs);
  } else {
    destImageContext.putImageData(sourceCanvas, properOffsets/RectsArgs);
  }

I'll probably try to come up with a pure haxe/html5 impl. to test if this is viable, but any efforts in coding this with openfl directly would be great.

Thank you so much for all of your help. Your work has been extremely thorough, and was directly helpful in the commit I've just made, implementing improvements for better alpha handling in copyPixels :smile:
I just realized that I don't believe that we have 100% accurate behavior in the ImageCanvasUtil.copyPixels render path -- your sample hits the data path. I'll have to try and circle back with tests on the canvas path, but this is already much better :smile:

Great! I knew it's a feature not many use (alphaImage), but glad to know my investigations were useful! :+1: (...at last :stuck_out_tongue_winking_eye:)
PS: it seems there's a redundant check here https://github.com/openfl/lime/blob/b60f6bd94e44e698f5fce252d32168386523765e/lime/graphics/Image.hx#L362
Thanks, really!


add docs on installing via GoFish

Signed-off-by: Matthew Fisher<EMAIL_ADDRESS>Description
As of https://github.com/fishworks/fish-food/pull/121, kubeaudit is installable via GoFish. I'm the maintainer of GoFish and I'm also happy to maintain the package from GoFish's side, but the code's all open source.
How Has This Been Tested?
To install:
><> gofish update
==> Rigs updated!
NAME
github.com/fishworks/fish-food

🐠  rigs updated in 1.359322726s
><> gofish install kubeaudit
==> Installing kubeaudit...
🐠  kubeaudit 0.4.1: installed in 109.548424ms
><> kubeaudit --help
kubeaudit is a program that checks security settings on your Kubernetes clusters.

To upgrade, use either:
><> gofish upgrade
><> gofish upgrade kubeaudit

Checklist:

[x] I have :tophat: my changes
[x] I have performed a self-review of my own code
[x] I have made corresponding changes to the documentation

Bah. I'm not going to go through the legal effort to sign off on the CLA, so I'm going to close this.
That being said, this is available and can be used by the community. Feel free to add it to the docs or not :)

@klautcomputing

Hi @bacongobbler  thank you for this PR, We'd love to add GoFish installation support to our docs. I'll hopefully add it to the docs tomorrow 💯

@bacongobbler I think we wanna do this 🙂

I'm not going to go through the legal effort to sign off on the CLA

I'm not sure how you expect to merge this PR without a legal sign-off from my employer. :(


Missing PHP file icon

I noticed that PHP files used standard icon instead of Material one.
See screenshot below:

My Atom Material Icons config:

In plugin's sources I found PHP file association string, but it's commented out:

I suppose this has something to do with the UI Icons ("Enable UI Icons" option).

Yes, PHP icons are different because they use UI icons to change their icons, instead of the regular psi icons. Uncommenting the line would cause all PHP files to have the elephpant, thus not being able to distinguish between regular PHP files and files with classes/traits/etc...


Update service-admin-portal-goals-settings.md

First paragraph from Get started with metrics in Power BI copied to the second section in Metrics tenant settings.
Thank you for contributing to Microsoft Fabric documentation
Fill out these items before submitting your pull request:
If you are working internally at Microsoft:
Provide a link to an Azure DevOps Boards work item that tracks this feature/update.

Who is your primary Skilling team contact? @mention them individually tag them and let them review the PR before signing off.

For internal Microsoft contributors, check off these quality control items as you go

[ ] 1. Check the Acrolinx report: Make sure your Acrolinx Total score is above 80 minimum (higher is better) and with no spelling issues. Acrolinx ensures we are providing consistent terminology and using an appropriate voice and tone, and helps with localization.

[ ] 2. Successful build with no warnings or suggestions: Review the build status to make sure all files are green (Succeeded).

[ ] 3. Preview the pages:: Click each Preview URL link to view the rendered HTML pages on the review.learn.microsoft.com site to check the formatting and alignment of the page. Scan the page for overall formatting, and look at the parts you edited in detail.

[ ] 4. Check the Table of Contents: If you are adding a new markdown file, make sure it is linked from the table of contents.

[ ] 5. #sign-off to request PR review and merge: Once the pull request is finalized and ready to be merged, indicate so by typing #sign-off in a new comment in the Pull Request. If you need to cancel that sign-off, type #hold-off instead. Signing off means the document can be published at any time. Note, this is a formatting and standards review, not a technical review.

Merge and publish

After you #sign-off, there is a separate PR Review team that will review the PR and describe any necessary feedback before merging.
The review team will use the comments section in the PR to provide feedback if changes are needed. Address any blocking issues and sign off again to request another review.
Once all feedback is resolved, you can #sign-off again. The PR Review team reviews and merges the pull request into the specified branch (usually the main branch or a release- branch).
From the main branch, the change is merged into the live branch several times a day to publish it to the public learn.microsoft.com site.

#sign-off

#hold-off

@paulinbar
Can you review the proposed changes?
When the changes are ready for publication, add a #sign-off comment to signal that the PR is ready for the review team to merge.
#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

#please-close
@Court72 This is being handled another way.


Robust and faster pod GC

Currently, when we need to GC a pod, we stick it on an in-memory channel and have another Goroutine delete the pods one by one.

Controller restart -> pods never get deleted?
Transient error in deletion ->   pods never get deleted?
O(n) API invocations to delete n pods.
Deletion has a thundering-herd problem.

I could be wrong mind you:

Controller restarts and workflow gets reconciled again.
We have a normal 20m resync -> reconciled.
Reconciliation re-queues pods.

Can we make O(2) API call using DeleteCollection + labelSelector + fieldSelector?
Depends on:

/status/phase === /nodes/node/phase
Most Kuberenetes providers correctly supporting DeleteCollection with a field-selector.

I've done some tests and I don't think this has the impact I thought it did in most scenarios.