text:
Timeouts on Vercel deployments

I'm using the following configuration of handling webhooks. While it's working in development (API route build time is under 1.5s), Vercel constantly reports function timeout without response. Some of the commands are using image send from static host with ctx.replyWithPhoto. The std/http method is the only one working for me, neither http/https, not next-js are not working because of different issues
import { Context as GrammyContext, SessionFlavor } from "grammy";
import { Conversation, ConversationFlavor } from "@grammyjs/conversations";

export interface SessionData {
  // session fields types
}

export type Context = GrammyContext &
  ConversationFlavor &
  SessionFlavor<SessionData>;
export type ConversationContext = Conversation<Context>;

export const POST = async (req: NextRequest, ...args: any[]) => {
  const { data, error } = await supabase
    .from("companies")
    .select("bot_token")
    .eq("slug", req.headers.get("host")!.split(".")[0])
    .single();

  if (error) {
    return NextResponse.json({ ...error }, { status: 500 });
  }

  const token = data.bot_token;

  const middleware = new Composer<Context>();

  middleware.command("start", start);
  middleware.command("request", request);

  const bot = new Bot<Context>(token);

  bot.use(
    session({
      initial: () => ({
        ...
      }),
      storage: enhanceStorage({
        storage: freeStorage(token),
        millisecondsToLive: 10 * 60 * 1000,
      }),
    })
  );

  // conversations, commands and handlers used here

  bot.catch((err) => {
    console.error("Error:", err);
  });

  const handleUpdate = webhookCallback(bot, "std/http", "throw", 15_000);

  return handleUpdate(req, ...args);
};

Any suggestions or recommendations?
Thanks in advance!

Is it a typo that you never register the composer instance called middleware?
Either way, this should not affect the reported problem. If you don't register it, the middleware tree will just complete faster.
As a first step, I would try to simplify the code so you can narrow down where the problem is. Do you use serverless functions or edge functions? The correct adapter is different for the two runtimes. Did you try the minimal example for vercel from our example bots repository at https://github.com/grammyjs/examples/tree/main/setups, or did you follow the guide at https://grammy.dev/hosting/vercel? What changes if you use a minmal example with a single bot instance, rather than creating the bot on the fly? (I don't think it's related to that, but this just means that you can throw it out in order to pinpoint the issue.)

Hey @KnorpelSenf! I'm using Serverless Functions for API routes. I also tried to simplify the implementation to use only start command which responds with ctx.replyWithPhoto
Regarding the middleware it's not a typo, I omitted some code (don't know why, actually). Here is the full route
import { NextRequest, NextResponse } from "next/server";

import {
  Bot,
  Composer,
  webhookCallback,
  session,
  enhanceStorage,
} from "grammy";
import { conversations, createConversation } from "@grammyjs/conversations";
import { freeStorage } from "@grammyjs/storage-free";

import { handlers } from "@/bot/handlers";

import { start } from "@/bot/commands/start";
import { request } from "@/bot/commands/request";
import { request as requestConversation } from "@/bot/conversations/request";
import { details } from "@/bot/callbacks/details";

import { supabase } from "@/utils/supabase";

import type { Context } from "@/bot/types";

export const POST = async (req: NextRequest, ...args: any[]) => {
  const { data, error } = await supabase
    .from("companies")
    .select("bot_token")
    .eq("slug", req.headers.get("host")!.split(".")[0])
    .single();

  if (error) {
    return NextResponse.json({ ...error }, { status: 500 });
  }

  const token = data.bot_token;

  const middleware = new Composer<Context>();

  middleware.command("start", start);
  middleware.command("request", request);

  const bot = new Bot<Context>(token);

  bot.use(
    session({
      initial: () => ({
        name: "",
        slug: "",
        phone: "",
      }),
      storage: enhanceStorage({
        storage: freeStorage(token),
        millisecondsToLive: 10 * 60 * 1000,
      }),
    })
  );

  bot.use(conversations());
  bot.use(createConversation(requestConversation, "request"));

  bot.use(handlers);
  bot.use(middleware);

  bot.callbackQuery("request", (ctx) => ctx.conversation.enter("request"));
  bot.callbackQuery("details", details);

  bot.on("message", async (ctx) => {
    await ctx.reply("Я поки що не знаю що з цим робити");
  });

  bot.catch((err) => {
    console.error("Error:", err);
  });

  const handleUpdate = webhookCallback(bot, "std/http", "throw", 15_000);

  return handleUpdate(req, ...args);
};

I also tried to log every step with Sentry and can see that the latest log is displayed in my console. So, my assumption is that something goes wrong in webhookCallback
import { NextRequest, NextResponse } from "next/server";

import {
  Bot,
  Composer,
  webhookCallback,
  session,
  enhanceStorage,
} from "grammy";
import { conversations, createConversation } from "@grammyjs/conversations";
import { freeStorage } from "@grammyjs/storage-free";
import * as Sentry from "@sentry/nextjs"

import { handlers } from "@/bot/handlers";

import { start } from "@/bot/commands/start";
import { request } from "@/bot/commands/request";
import { request as requestConversation } from "@/bot/conversations/request";
import { details } from "@/bot/callbacks/details";

import { supabase } from "@/utils/supabase";

import type { Context } from "@/bot/types";

export const POST = async (req: NextRequest, ...args: any[]) => {
  const { data, error } = await supabase
    .from("companies")
    .select("bot_token")
    .eq("slug", req.headers.get("host")!.split(".")[0])
    .single();

  if (error) {
    return NextResponse.json({ ...error }, { status: 500 });
  }

  const token = data.bot_token;

  Sentry.captureMessage('middleware = new Composer')
  const middleware = new Composer<Context>();
  Sentry.captureMessage('middleware = new Composer done')

  Sentry.captureMessage('middleware Composer use')
  middleware.command("start", start);
  middleware.command("request", request);
  Sentry.captureMessage('middleware Composer use done')

  Sentry.captureMessage(`new Bot: ${token}`)
  const bot = new Bot<Context>(token);
  Sentry.captureMessage('new Bot done')

  Sentry.captureMessage('bot.use')
  bot.use(
    session({
      initial: () => ({
        name: "",
        slug: "",
        phone: "",
      }),
      storage: enhanceStorage({
        storage: freeStorage(token),
        millisecondsToLive: 10 * 60 * 1000,
      }),
    })
  );
  Sentry.captureMessage('bot.use done')

  Sentry.captureMessage('bot.use conversations')
  bot.use(conversations());
  bot.use(createConversation(requestConversation, "request"));
  Sentry.captureMessage('bot.use conversations done')

  Sentry.captureMessage('bot.use handlers')
  bot.use(handlers);
  bot.use(middleware);
  Sentry.captureMessage('bot.use handlers done')

  Sentry.captureMessage('bot.callbackQuery')
  bot.callbackQuery("request", (ctx) => ctx.conversation.enter("request"));
  bot.callbackQuery("details", details);
  Sentry.captureMessage('bot.callbackQuery done')

  Sentry.captureMessage('bot.message')
  bot.on("message", async (ctx) => {
    await ctx.reply("Я поки що не знаю що з цим робити");
  });
  Sentry.captureMessage('bot.message done')

  bot.catch((err) => {
    Sentry.captureException(err);

    return NextResponse.json({ ...err }, { status: 500 });
  });

  Sentry.captureMessage('handleUpdate')
  const handleUpdate = webhookCallback(bot, "std/http", "throw", 15_000);
  Sentry.captureMessage('handleUpdate done')

  return handleUpdate(req, ...args);
};

Ah well, we do not have support for next/server yet. The next-js adapter is compatible with Next.js serverless functions, which have a different API signature.
The way these framework adapters work is that you first need to take a look at how your particular server expects its middleware to be. For next/server, you can see an example here. This tells you that you need to do something like
import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'

export function middleware(request: NextRequest) {
  return NextResponse.next();
}

grammY defines its framework adapters in this file: https://github.com/grammyjs/grammY/blob/1c238c0f08df047dc8dc11dd069519cc4c68b7ee/src/convenience/frameworks.ts
Look at how every adapter maps function signatures like the above to a generic ReqResHandler object that the webhook callback logic can work with. Currently, there is no compatible adapter for next/server since we never import NextResponse.
(We might be able to add support by simply returning a new Reponse() but it doesn't seem to be documented that this actually works, so we'd have to experiment with it. /cc @PonomareVlad)
Until then, grammY provides a callback adapter that works with any framework:
https://github.com/grammyjs/grammY/blob/1c238c0f08df047dc8dc11dd069519cc4c68b7ee/src/convenience/webhook.ts#L14-L24
This means that something similar to the following code will work (no promises, coded on github.com):
import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'

const handleUpdate = webhookCallback(bot, "callback");

export function middleware(request: NextRequest) {
  const update = await request.json();
  const header = request.headers.get("X-Telegram-Bot-Api-Secret-Token");
  return await handleUpdate(update, (json: string) => new NextResponse(json), header);
}

I'm curious if this works, please keep us posted.

@KnorpelSenf looking into the code I see that webhookCallback doesn't export callback as supported adapter in TS. Anyway it does use the function, but the Next CLI fails locally because of
Error: No response is returned from route handler '...'. Ensure you return a `Response` or a `NextResponse` in all branches of your handler.

@KnorpelSenf looking into the code I see that webhookCallback doesn't export callback as supported adapter in TS

You're right, this needs to be fixed. It was caused by an incomplete refactoring some time ago.

Anyway it does use the function, but the Next CLI fails locally

Hmmm then perhaps you need to go even one more step back and provide a FrameworkAdapter that makes use of handlerReturn?

@all-contributors add @thecoorum for the bug

I see that std/http seems to be using handlerReturn (accordingly to the comments in frameworks.d.ts), but not sure how I should adjust the response then 🤔
Also, as I mentioned before the default configuration for std/http is working properly in local environment and fails in production only

not sure how I should adjust the response then 🤔

I guess you need to create a NextResponse object?

Also, as I mentioned before the default configuration for std/http is working properly in local environment and fails in production only

Right. I have no idea about this one. I have never used nextjs myself. What is the difference between the local and the production environment? (grammY itself certainly doesn't behave differently, it is not aware of its surroundings.)

Looking into the structure of std/http can't understand why it's not working in production. I see it's returning regular Response which is also acceptable by NextJS. They allow to return either Response or NextResponse (which as far as I remember is an extensions of Response with some extra methods)
I suspect that maybe resolveResponse is not assigned with Promise.resolve and because of that end, respond and unauthorized callbacks are never fired

I tried to extract the logic from the webhookCallback straight into my route and while it's working in development it still times out in production. I also skipped the logic of the verifying bot token and token from headers as for some reason there was no X-Telegram-Bot-Api-Secret-Token request header present
import { type NextRequest, NextResponse } from "next/server";
import { Bot } from "grammy";

const bot = new Bot(process.env.REQUESTS_BOT_TOKEN!);

bot.on("message", async (ctx) => {
  await ctx.reply("Ping");
});

function timeoutIfNecessary(
  task: Promise<void>,
  onTimeout: "throw" | "return" | (() => unknown),
  timeout: number
): Promise<void> {
  if (timeout === Infinity) return task;
  return new Promise((resolve, reject) => {
    const handle = setTimeout(() => {
      if (onTimeout === "throw") {
        reject(new Error(`Request timed out after ${timeout} ms`));
      } else {
        if (typeof onTimeout === "function") onTimeout();
        resolve();
      }
    }, timeout);
    task
      .then(resolve)
      .catch(reject)
      .finally(() => clearTimeout(handle));
  });
}

export const POST = async (req: NextRequest) => {
  let initialized = false;

  if (!initialized) {
    await bot.init();

    initialized = true;
  }

  let usedWebhookReply = false;

  const webhookReplyEnvelope = {
    send: async (json: any) => {
      usedWebhookReply = true;
      await new Promise((resolve) => resolve(NextResponse.json(json)));
    },
  };

  await timeoutIfNecessary(
    bot.handleUpdate(await req.json(), webhookReplyEnvelope),
    "throw",
    10_000
  );

  if (!usedWebhookReply) {
    return NextResponse.json(null, { status: 200 });
  }
};

while it's working in development it still times out in production

This sort of gives me the feeling that neither of us is making obvious mistakes in the code. It sort of boils down to differences between dev and prod, such as having different implementations of global objects like Request/Response/Promise.
The above code is a fairly short example that reproduces the issue (https://sscce.org). It could be a good idea to contact the people from nextjs to find out why the code behaves differently.

for some reason there was no X-Telegram-Bot-Api-Secret-Token request header present

This is expected. It is only present if you configure it when setting your webhook.

I opened a discussion in the NextJS repo, let's see if any useful suggestions will appear there
https://github.com/vercel/next.js/discussions/59652

Nice, subscribed. You may wanna include the above code in the discussion so that people don't need to understand grammY before they're able to look into the issue.
What happens if you throw out the timeoutIfNecessary function and let the bot handle the update directly? Does that fix it?

Do you mean just calling bot.handleUpdate with payload? Didn't check this approach and unfortunately will be able to do this only tomorrow

Yep! That would be the next step in narrowing down the problem. By continuing to remove seemingly unrelated code, we either end up removing the code that causes the problem, or we end up with a tiny bit of code that causes the problem. Either way, we will have isolated it, which allows the bug to be fixed (either by us or by them).

Hey @KnorpelSenf! Sorry for long reply, wasn't able to test out the suggestion you made during weekends. I tried to implement it now, but it still failing with timeout. Including the source code of the endpoint and the screenshot of log for triggering the endpoint
app/api/bots/requests/route.ts
import { type NextRequest, NextResponse } from "next/server";
import { Bot } from "grammy";

import { supabase } from "@/utils/supabase";

const bot = new Bot(process.env.REQUESTS_BOT_TOKEN!);

bot.on("message::bot_command", async (ctx) => {
  // Match command pattern /process_<id>
  const match = ctx.message!.text!.match(/^\/process_(\d+)$/);

  if (!match) return;

  const id = match[1];

  const { data, error } = await supabase
    .from("requests")
    .select()
    .eq("id", id)
    .single();

  if (error) {
    await ctx.reply("Виникла помилка при завантаженні заявки.");
    await ctx.reply(error.message);

    return;
  }

  await ctx.reply(
    `

company_name: ${data.company_name}
company_slug: ${data.company_slug}
phone_number: ${data.phone_number}
user_id: ${data.user_id}
user_username: ${data.user_username}

    `
  );
});

bot.on("message", async (ctx) => {
  await ctx.reply("Ping");
});

export const POST = async (req: NextRequest) => {
  let initialized = false;

  if (!initialized) {
    await bot.init();

    initialized = true;
  }

  let usedWebhookReply = false;

  const webhookReplyEnvelope = {
    send: async (json: any) => {
      usedWebhookReply = true;
      await new Promise((resolve) => resolve(NextResponse.json(json)));
    },
  };

  await bot.handleUpdate(await req.json(), webhookReplyEnvelope);

  if (!usedWebhookReply) {
    return NextResponse.json(null, { status: 200 });
  }
};

Awesome!
Just to be sure, the webhook reply envelope is never used, right? You didn't enable the feature. So you should be able to empty send and see the same behaviour. Also, I assume that you tested the ping handler, which timed out, so you should be able to remove the entire command handler and still see the same behaviour. Also, I suspect the init call to not be the problem because it only calls getMe, so you should be able to specify the bot info when constructing your bot. This will make sure that you no longer need to call init but still be able to see the same behaviour.
This should leave you with <20 lines of code that have virtually no logic and still reproduce the issue. Can you confirm?
(Perhaps you now see where I'm going with this.)

i'm so glad there is at least an issue... i've been dancing with it for too long...
so the official current state if things is that Grammy doesnt work in production Next.js?
i use latest grammy 1.20.3 and nextjs 14.0.4

Nobody really knows. I'm not using nextjs so I haven't investigated it.

use node >= 20 version
🎩

Very interesting stuff. @thecoorum can you confirm that this fixes it?

At some point I decided to migrate my bot to Deno, so it will take me some time to replicate the existing bot back on Next.js. I will post an update as soon as I will do some testings

Hmm, despite upgrading Vercel's Node version to 20.x bot is still timing out. @di-sukharev is there anything else you did?
I will share the code of my bot, maybe I did something wrong...
import { NextRequest } from "next/server";

import {
  Bot,
  Composer,
  webhookCallback,
  session,
  enhanceStorage,
} from "grammy";
import { conversations, createConversation } from "@grammyjs/conversations";
import { freeStorage } from "@grammyjs/storage-free";

import { handlers } from "@/bot/handlers";

import { start } from "@/bot/commands/start/admin";
import { request } from "@/bot/commands/request";
import { description } from "@/bot/commands/description";
import { process as processCommand } from "@/bot/commands/process";
import { request as requestConversation } from "@/bot/conversations/request";
import { process as processConversation } from "@/bot/conversations/process";
import { details } from "@/bot/callbacks/details";

import type { Context } from "@/bot/types";

const token = process.env.ADMIN_BOT_TOKEN!;

const middleware = new Composer<Context>();

middleware.command("start", start);

middleware.on("message::bot_command", processCommand);

const bot = new Bot<Context>(token);

bot.use(
  session({
    initial: () => ({}),
    storage: enhanceStorage<{}>({
      storage: freeStorage(token),
      millisecondsToLive: 10 * 60 * 1000,
    }),
  })
);

bot.use(conversations());
bot.use(createConversation(requestConversation, "request"));
bot.use(createConversation(processConversation, "process"));

bot.use(handlers);
bot.use(middleware);

bot.callbackQuery("request", (ctx) => ctx.conversation.enter("request"));
bot.callbackQuery("description", details);

bot.on("message", async (ctx) => {
  // ...
});

// bot.catch((error) => {
//   Sentry.captureException(error);
// });

const handleUpdate = webhookCallback(bot, "std/http");

export const POST = async (req: NextRequest, ...rest: any[]) => {
  return handleUpdate(req, ...rest);
};

@thecoorum i thought it's the node version, but when then it failed again, so i now know it's not..
but good news is that is that it doesnt matter, bc i anyway made it work :)
this is my webhook code in src/app/api/bot/route.ts:
import { webhookCallback } from "grammy";
import { NextRequest } from "next/server";

import { Bot, Context, InlineKeyboard } from "grammy";

interface BotConfig {
  isDeveloper: boolean;
}

type ExtendedContext = Context & { config: BotConfig };

const telegramBotWebhookHandler = async (req: NextRequest, ...args: any[]) => {
  const bot = new Bot<ExtendedContext>(process.env.TELEGRAM_BOT_KEY!);

  bot.use(async (ctx, next) => {
    const isInWhiteList = false;

    if (isInWhiteList) {
      ctx.config = { isDeveloper: isInWhiteList };
      await next();
    } else {
      try {
        console.log(`forbidden access from user ${ctx?.from?.id}`);
        await ctx.reply("❌ 403 ❌");
      } catch (error) {
        console.log(error);
      }
    }
  });

  bot.command("start", (ctx) =>
    ctx.reply(
      `Hi ${ctx.from?.first_name}`
    )
  );

  bot.hears("ping", async (ctx) => {
    await ctx.reply("pong 🏓", {
      reply_to_message_id: ctx.msg.message_id,
    });
  });

  bot.on("message:text", async (ctx) => {
    console.log("GOT MSG: ", ctx.msg.text);

    const inlineKeyboard = new InlineKeyboard().webApp(
      "Open app",
      `${process.env.TELEGRAM_WEBAPP_URL}`
    );

    await ctx.reply("Hi", { reply_markup: inlineKeyboard });
  });

  const handleBotWebhook = webhookCallback(
    bot,
    "std/http",
    "throw",
    10000,
    process.env.TELEGRAM_WEBHOOK_KEY
  );

  console.info("BOT REQUEST", { req, args });

  return handleBotWebhook(req, ...args);
};

export { telegramBotWebhookHandler as POST };

this is the script i run after each next js build:
import { Bot } from "grammy";

const bot = new Bot(process.env.TELEGRAM_BOT_KEY!);

// @ts-ignore
const isBotWebhookSet = await bot.api.setWebhook(
  process.env.TELEGRAM_WEBHOOK_URL!,
  {
    secret_token: process.env.TELEGRAM_WEBHOOK_KEY,
  }
);

console.info({ message: "Successfully updated the webhook", isBotWebhookSet });

my local node version is v20

What is the key difference between this and the code in the original issue description?

I can't see a real difference between the initial code and the working one, only the export code style, but that shouldn't matter

Just to be clear, the two of you are using the same code with the same hosting provider and you observe different behaviour? That means that it isn't related to your code, but rather to something else entirely.
I honestly don't see how grammY can have something to do with this, so I don't think it will be fixed in the library (unless new evidence shows up). Feel free to close this issue, or keep it open and discuss further, whatever you prefer. :)

I will close this, as I do not see what we can do here. Feel free to reopen if you find out more things, and especially so if you can narrow down that there is a problem with grammY.

Oh, ok.. Now it is my turn 🚬
Has anyone managed to figure out the root cause of the issue or find a solution?

I think I have found a solution to the issue.
The key lies in how Next.js handles server dependencies during build time. Just add the grammy dependency to serverComponentsExternalPackages in the next.config.js config and it should work.
Find more information about serverComponentsExternalPackages"here: https://nextjs.org/docs/app/api-reference/next-config-js/serverComponentsExternalPackages
My code:
Route
// src/app/api/bot/route.ts

import { NextRequest } from 'next/server';
import { Bot, webhookCallback } from 'grammy';

export const POST = async (req: NextRequest, ...args: any[]) => {
	const token = process.env.TELEGRAM_TOKEN;
	if (!token) throw new Error('TELEGRAM_TOKEN is unset');

	const bot = new Bot(token);

	bot.command('start', ctx => ctx.reply('Ласкаво просимо! Бот запущений.'));

	bot.on('message', ctx => ctx.reply('Отримав ще одне повідомлення!'));

	const handleUpdate = webhookCallback(bot, 'std/http', 'throw', 10000);

	return handleUpdate(req, ...args);
};

Next.js config
// next.config.mjs

/** @type {import('next').NextConfig} */
const nextConfig = {
	experimental: {
		serverComponentsExternalPackages: ['grammy'],
	},
};

export default nextConfig;

I hope this will be useful to someone who also decides to create a telegram bot w/ grammY and Next.js.

Interesting stuff, thanks for sharing.
By the way,
// src/app/api/bot/route.ts

import { NextRequest } from 'next/server';
import { Bot, webhookCallback } from 'grammy';

export const POST = async (req: NextRequest, ...args: any[]) => {
	const token = process.env.TELEGRAM_TOKEN;
	if (!token) throw new Error('TELEGRAM_TOKEN is unset');

	const bot = new Bot(token);

	bot.command('start', ctx => ctx.reply('Ласкаво просимо! Бот запущений.'));

	bot.on('message', ctx => ctx.reply('Отримав ще одне повідомлення!'));

	const handleUpdate = webhookCallback(bot, 'std/http', 'throw', 10000);

	return handleUpdate(req, ...args);
};

is a little inefficient because it recreates the bot for every update. This also means that it will have to re-initialize for every update, i.e. call getMe.
Here is the optimised version:
// src/app/api/bot/route.ts

import { Bot, webhookCallback } from 'grammy';

const token = process.env.TELEGRAM_TOKEN;
if (!token) throw new Error('TELEGRAM_TOKEN is unset');

const bot = new Bot(token);

bot.command('start', ctx => ctx.reply('Ласкаво просимо! Бот запущений.'));

bot.on('message', ctx => ctx.reply('Отримав ще одне повідомлення!'));

export const POST =  webhookCallback(bot, 'std/http');

I think I have found a solution to the issue.
The key lies in how Next.js handles server dependencies during build time. Just add the grammy dependency to serverComponentsExternalPackages in the next.config.js config and it should work. Find more information about serverComponentsExternalPackages"here: https://nextjs.org/docs/app/api-reference/next-config-js/serverComponentsExternalPackages
My code:
Route
// src/app/api/bot/route.ts

import { NextRequest } from 'next/server';
import { Bot, webhookCallback } from 'grammy';

export const POST = async (req: NextRequest, ...args: any[]) => {
	const token = process.env.TELEGRAM_TOKEN;
	if (!token) throw new Error('TELEGRAM_TOKEN is unset');

	const bot = new Bot(token);

	bot.command('start', ctx => ctx.reply('Ласкаво просимо! Бот запущений.'));

	bot.on('message', ctx => ctx.reply('Отримав ще одне повідомлення!'));

	const handleUpdate = webhookCallback(bot, 'std/http', 'throw', 10000);

	return handleUpdate(req, ...args);
};

Next.js config
// next.config.mjs

/** @type {import('next').NextConfig} */
const nextConfig = {
	experimental: {
		serverComponentsExternalPackages: ['grammy']
	}
};

export default nextConfig;

I hope this will be useful to someone who also decides to create a telegram bot w/ grammY and Next.js.

You helped me a lot! Thank you very much!!

Perhaps we can add this info to the vercel setup in the example bots repository? @triken22 would you like to take care of that?

authors: KnorpelSenf alexiuscrow di-sukharev thecoorum triken22

repo: grammyjs/grammY

license: MIT


text:
feat: update pending updates count

The webhook utility component should update the value for pending updates automatically.
Perhaps this could be done by the following rules:

upon receiving focus for the site
every 30 seconds if the count is 0
every second if the count is >0

Perhaps we can suspend the updates if the count isn't visible (component is scrolled out of view or hidden by another OS window)

This is no longer a thing.

source: gharchive/issue

repo: grammyjs/tools

license_type: permissive

license_source: github-api


text:
[POC] Automatically prefix types with namespace and namespace Query

This is more of a proof of concept to gauge interest in such features.
This PR adds two options to gramps: prefixTypesWithNamespace and namespaceQuery.
prefixTypesWithNamespace (boolean) - If true, gramps will automatically rename types to prefix the namespace of their respective data source.
namespaceQuery (boolean) - If true, gramps will automatically place all Query types for each data source in their own "namespace" in the base Query.
The purpose of adding this functionality is to prevent data source developers from stepping on each other's toes and make the life of the GrAMPS server owner easier since they would otherwise have to communicate with these teams to resolve the conflicts that these options can prevent.
Consider the following data sources:
const firstDataSource = {
  namespace: 'First',
  schema: `
    type Query {
      items: [ItemList]
    }
    type ItemList {
      count: Int
      items: [Int]
    }
  `,
  resolvers: { ... }
};

const secondDataSource = {
  namespace: 'Second',
  schema: `
    type Query {
      items: [ItemList]
    }
    type ItemList {
      count: Int
      items: [String]
    }
  `,
  resolvers: { ... }
};

There are two conflicts in the above data sources: the ItemList type and the items query.
In the case of the ItemList type, by default only one of the types will be used. According to the documentation for mergeSchemas:

The default logic is to take the first encountered type of all the types with the same name.

In the case above the ItemList returning type Int would win causing an issue for the second data source.
Enabling prefixTypesWithNamespace would help to resolve this conflict by renaming the first ItemList to First_ItemList and the second to Second_ItemList.
There is still a conflict at the query level. In this case, I believe that the last field added to query wins; although, I am not sure. So the first data source items query would not be accessible.
Enabling namespaceQuery would help to resolve this conflict by placing all of a data sources queries into its own root. So, instead of
type Query {
  items: Second_ItemList
}

we would get
type Query {
  First: First_Query
  Second: Second_Query
}

type First_Query {
  items: First_ItemList
}

type Second_Query {
  items: Second_ItemList
}

Of course, the client would need to account for this in their queries
query getItems {
  First {
    items {
      count
      items
    }
  }
}

There are advanced cases where we would not want to automatically prefix type names or namespace the root Query so these options are disabled by default.

Looking at this, I think it might make more sense as a kind of plugin or other non-core feature. Ideally, devs will prefix when designing the schema.
Otherwise we're introducing magic here, which I think is best avoided (or at least only provided in an explicitly opt-in — e.g. plugin — fashion). Does that make sense/seem reasonable?

Closing this — I do still think this could be a useful helper add-on, though, so if you build it out please let me know.

source: gharchive/pull-request

authors: corycook jlengstorf

repo: gramps-graphql/gramps


text:
Issue Registering Provider in Robolectric Tests

I'm trying to run Robolectric tests with code that uses Tray, but immediately get the following error for any classes that access AppPreferences:
java.lang.IllegalStateException: could not access stored data with uri content://com.example.tray/internal_preferences/com.example/version?backup=true. Is the provider registered in the manifest of your application?
Is there a suggested set up for unit testing classes that use Tray? I tried following the existing Tray library unit tests, but ran into issues since TrayContract is private scope.

I never tested it with Robolectric but it doesn't look like a big problem.
You have to make sure that context.getString(R.string.tray__authority) (here context is the Application context) returns the correct authority. I'm not sure if Robolectric works with the generated.xml files which could cause this error.
Please check if mocking the string resource works.
RuntimeEnvironment.application = spy(RuntimeEnvironment.application);
when(RuntimeEnvironment.application.getApplicationContext())
    .thenReturn(RuntimeEnvironment.application);

Resources spiedResources = spy(app.getResources());
when(app.getResources())
    .thenReturn(spiedResources);

when(spiedResources.getString(R.string.tray__authority))
    .thenReturn("my.authority.for.tray");

As @passsy mentioned I guess Robolectric doesn't find a generated String for the authority.
I'm not an Robolectric expert, but you can provide a BuildConfig for it. Make sure you register the correct Provider for Robolectric too. Here is an example (which hopefully works 😄 )
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class)
public class MyAwesomeTest {

    @Before
    public void setUp() throws Exception {
        TrayContentProvider provider = new TrayContentProvider();
        provider.onCreate();
        ShadowContentResolver.registerProvider(BuildConfig.APPLICATION_ID + ".preferences", provider);
    }

    @Test
    public void myTotallyAwesomeTest() throws Exception {
        AppPreferences appPreferences = new AppPreferences(RuntimeEnvironment.application);
        appPreferences.put("key", "test");
        String test = appPreferences.getString("key");
        assertThat(test, equalTo("test"));
    }
}

Let me know if this works.

Thank you both so much for your help!  I have now successfully moved on from the URI error, but still get an error during setUp when I attempt to access R.string.tray__authority.
android.content.res.Resources$NotFoundException: unknown resource 2131034186
I also get the same error if I skip the string resource mocking code and I attempt to run only the code suggested by @jannisveerkamp . I get the error when I call provider.onCreate() (which ultimately attempts to access R.string.tray__authority).
Its like Robolectric cannot even see this string resource at all.
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk=21)
public class TrayTest {

  @Before
  public void setUp() throws Exception {
    RuntimeEnvironment.application = spy(RuntimeEnvironment.application);
    when(RuntimeEnvironment.application.getApplicationContext())
        .thenReturn(RuntimeEnvironment.application);

    Resources spiedResources = spy(RuntimeEnvironment.application.getResources());
    when(RuntimeEnvironment.application.getResources())
        .thenReturn(spiedResources);

    when(spiedResources.getString(R.string.tray__authority))
        .thenReturn("com.example.tray");

    TrayContentProvider provider = new TrayContentProvider();
    provider.onCreate();
    ShadowContentResolver.registerProvider(BuildConfig.APPLICATION_ID + ".preferences", provider);
  }

  @Test
  public void myTotallyAwesomeTest() throws Exception {
    assertTrue(true);
    //AppPreferences appPreferences = new AppPreferences(RuntimeEnvironment.application);
    //appPreferences.put("key", "test");
    //String test = appPreferences.getString("key");
    //assertThat(test, equalTo("test"));
  }
}

Turns out, Robolectric has a difficult time accessing generated resource values.  At first I tried extending RobolectricGradleTestRunner class to add extra directories to the resource path, but this did not work. Ultimately, I had to create a shadow resource like this:
@Implements(Resources.class)
public class CustomShadowResource extends ShadowResources {
  @Override
  public CharSequence getText(int id) throws Resources.NotFoundException {
    if (id == R.string.tray__authority) return "com.example.tray";

    return super.getText(id);
  }
}

Then include this Shadow resource in my TrayTest class like this:
@Config(constants = BuildConfig.class, sdk=21, shadows = CustomShadowResource.class)
While I have resolved the missing string resource issue, the provider registration issue has returned:
java.lang.IllegalStateException: could not access stored data with uri content://com.example.tray/internal_preferences/com.example/version?backup=true. Is the provider registered in the manifest of your application?

I haven't had the time to look deeper into this. But I suggest to mock the Storage of Tray. Instead of  TrayPreference you should work with AbstractTrayPreference and inject a Storage which doesn't require a ContenteProvider. You can use the MockTrayStorage. Of cause this doesn't allow you to test multiprocess stuff.
I note that mocking tray for tests isn't as simple as it should. #futureimprovement

Could anyone here please help on below problem, I'm getting similar kind of issue:
I have set up the roboelectric into my workspace, however I'm getting below error:
android.content.res.Resources$NotFoundException: unknown resource 2131231855
at org.robolectric.shadows.ShadowAssetManager.getAndResolve(ShadowAssetManager.java:351)
at org.robolectric.shadows.ShadowAssetManager.getResourceText(ShadowAssetManager.java:70)
at android.content.res.AssetManager.getResourceText(AssetManager.java)
at android.content.res.Resources.getText(Resources.java:270)
at org.robolectric.shadows.ShadowResources.getText(ShadowResources.java:358)
at android.content.res.Resources.getText(Resources.java)
at android.content.res.Resources.getString(Resources.java:360)
at org.robolectric.shadows.ShadowContext.getString(ShadowContext.java:33)
at org.robolectric.shadows.ShadowContextWrapper.getString(ShadowContextWrapper.java:81)
at android.content.Context.getString(Context.java)
at com.example.wallet.WalletApplication.onCreate(WalletApplication.java:70)
at org.robolectric.internal.ParallelUniverse.setUpApplicationState(ParallelUniverse.java:140)
at org.robolectric.RobolectricTestRunner.setUpApplicationState(RobolectricTestRunner.java:433)
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:240)
at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:188)
at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:54)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:152)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Android studio version: 2.3.3
Roboeletric version: 3.0
Test file code is:
Inline image 1

Inline image 2

@Implements(Resources.class)
public class CustomShadowResource extends ShadowResources {
  @Override
  public CharSequence getText(int id) throws Resources.NotFoundException {
    if (id == R.string.tray__authority) return "com.example.tray";

    return super.getText(id);
  }
}

I just tried this but it yields a compilation error: the class cannot resolve the override because there doesn't appear to be any getText(int) method in ShadowResources. I looked at the robolectric source code and don't see it there either. Am I missing something here? Maybe the API changed?

authors: KioKrofovitch jannisveerkamp nihk passsy vaibhavpali

repo: grandcentrix/tray

license_source: bigquery


text:
Fix bug with site_name=None

When og:site_name is null a ValueError occurs when attempting str.replace.
Stack trace:
In [3]: g.extract('https://blog.kissmetrics.com/tracking-marketing-campaigns/')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-98471b35ffad> in <module>()
----> 1 g.extract('https://blog.kissmetrics.com/tracking-marketing-campaigns/')

/home/yuri/repos/python-goose/goose/__init__.pyc in extract(self, url, raw_html)
     54         """
     55         cc = CrawlCandidate(self.config, url, raw_html)
---> 56         return self.crawl(cc)
     57
     58     def shutdown_network(self):

/home/yuri/repos/python-goose/goose/__init__.pyc in crawl(self, crawl_candiate)
     64         try:
     65             crawler = Crawler(self.config)
---> 66             article = crawler.crawl(crawl_candiate)
     67         except (UnicodeDecodeError, ValueError):
     68             self.config.parser_class = parsers[0]

/home/yuri/repos/python-goose/goose/crawler.pyc in crawl(self, crawl_candidate)
    152
    153         # title
--> 154         self.article.title = self.title_extractor.extract()
    155
    156         # check for known node as content body

/home/yuri/repos/python-goose/goose/extractors/title.py in extract(self)
    102
    103     def extract(self):
--> 104         return self.get_title()

/home/yuri/repos/python-goose/goose/extractors/title.py in get_title(self)
     81         if "title" in self.article.opengraph.keys():
     82             title = self.article.opengraph['title']
---> 83             return self.clean_title(title)
     84
     85         # try to fetch the meta headline

/home/yuri/repos/python-goose/goose/extractors/title.py in clean_title(self, title)
     40             site_name = self.article.opengraph['site_name']
     41             # remove the site name from title
---> 42             title = title.replace(site_name, '').strip()
     43
     44         # try to remove the domain from url

TypeError: expected a character buffer object

Another failing URL: https://blog.kissmetrics.com/your-first-online-sale/
Not sure what's the root cause of the error, because og:site_name seems to be there...

fixed in #217

Great, thanks!

authors: grangier yprez

repo: grangier/python-goose


text:
Fix y-title for function names

Close #47. I didn't try on many plots myself but it looks like it passes the CI. Sorry for all for the git changes, I don't know why it's like this, the changes are just a few lines at the beginning of plot2.default().
@grantmcdermott I'm still struggling with the tests suite of this package (esp. because I'm currently on Windows) so it's probably better if you can take over this PR to generate snapshots.
New behavior:
set.seed(42)
plot(rnorm(1))

library(plot2)
set.seed(42)
plot2(rnorm(1))

Sorry for all for the git changes, I don't know why it's like this, the changes are just a few lines at the beginning of plot2.default().

Is it perhaps this? Or maybe something to do with your lintr?
Regardless, I'll take a look shortly. Thanks @etiennebacher!

Is it perhaps this?

Thanks, I think it worked for future commits but I can't cancel for this PR

No worries

authors: etiennebacher grantmcdermott


text:
Here's a new site I'd like you to consider blocking

Here's a new site I'd like you to consider blocking:
https://www.quora.com
(please include any other relevant details)

I'll need an example here, since afaik people ask questions on quora and every answer under it is a comment, pretty much. Which comments do you see that should be blocked?

repo: grantwinney/hide-comments-everywhere


text:
https://einthusan.tv/movie/watch/1aPT/?lang=malayalamHere's a new site I'd like you to consider blocking

Here's a new site I'd like you to consider blocking:
https://einthusan.tv
(please include any other relevant details)

Comments on that site should already be blocked. Is there a particular page where they're not?


text:
format truncation error thrown

Hi I am getting a format truncation error when I run 'make clean all' in the benchmark directory.  Any guidance on how to get around this?
Thank you.
Werror_format-truncation.txt

I meet the same problem. Has it been solved?

repo: graphbig/graphBIG


text:
Improve wording when adding templates

two first lines can be improved
last line should read 'uncomment' instead of 'comment out'

I think the term is 'uncomment'

Added the functions & permissions of template twilio to graphcool.yml as comments.
Added the types of template twilio to types.graphql as comments.
would be my suggestion for the first two lines.

authors: do4gr kbrandwijk marktani

repo: graphcool/graphcool


text:
Add a mutate function

I tried your lib today, but then ran into the issue that it only allows to run queries. Would be cool to send mutations as well or maybe as a separate lib.

Hey @nikgraf! I assume you expected a mutate function because Lokka has one. Leaving it out has been a design decision the keep graphql-request simpler.
You can easily run mutations like this:
const mut = `mutation {
  createTodo(title: "Buy milk") { id }
`
request('https://my-endpoint.com/graphql', mut)

Please let me know if this doesn't work for you 🙂

@schickling hmm, it didn't. Shouldn't mutations be called mutation in the body. But here it's query: https://github.com/graphcool/graphql-request/blob/master/src/index.ts#L26

@nikgraf if the snippet above doesn't work, then it's most likely an issue to the implementation of the server.
There is no mutation field in the JSON payload being sent to GraphQL servers via HTTP. You can read more here: http://graphql.org/learn/serving-over-http/#post-request

Just checked. You are correct … hmmm need to check why this didn't work.

Hi, I can mutate data by graphiql interface. But when I use
const mut = `mutation {
  createTodo(title: "Buy milk") {
     id
     title
  }
}
`

request('https://my-endpoint.com/graphql', mut)

got error message
Unhandled Promise Rejection: Error: Parse error on "'" (error) at [2, 33]: {"response":{"errors":[{"message":"Parse error on \"'\" (error) at [2, 33]","locations":[{"line":2,"column":33}]}],"status":200},"request":{"query":"{\n  createTodo(user_id: 1, title: 'Complete GraphQL') {\n    id\n    title\n  }\n}"}}

Can you send the curl command from GraphiQL?

@hzchirs It seems that you're using simple quotes rather than doubles. If that's the case, just replace them. This error could also come from hard-coding an ENUM value with simple or double quotes. Hope it helps ;)

@THook 👍 It works fine right now. Thank you!

authors: THook hzchirs nikgraf schickling

repo: graphcool/graphql-request


text:
use PrepareGeometry in QueryGraph.query and Weighting using a Polygon

JTS allows us to prepare the polygon for batch requests that should speed up operations that involve a Polygon. This issue depends on #1485

This is fixed

repo: graphhopper/graphhopper


text:
j2objc translating problems for 0.6.0-RC1

While updating the iOS port to 0.6.0-RC1 I ran into some translation problems that are caused by the changed files. All errors are listed below.
The following block of errors are caused by changes to these files, and are pretty self explanatory.
error: graphhopper/core/src/main/java/com/graphhopper/coll/IntDoubleBinHeap.java:23: The type IntDoubleBinHeap must implement the inherited abstract method BinHeapWrapper<Number,Integer>.peekKey()
error: graphhopper/core/src/main/java/com/graphhopper/coll/IntDoubleBinHeap.java:23: The type IntDoubleBinHeap must implement the inherited abstract method BinHeapWrapper<Number,Integer>.pollElement()
error: graphhopper/core/src/main/java/com/graphhopper/coll/IntDoubleBinHeap.java:23: The type IntDoubleBinHeap must implement the inherited abstract method BinHeapWrapper<Number,Integer>.peekElement()
error: graphhopper/core/src/main/java/com/graphhopper/coll/IntDoubleBinHeap.java:23: The type IntDoubleBinHeap must implement the inherited abstract method BinHeapWrapper<Number,Integer>.clear()
error: graphhopper/core/src/main/java/com/graphhopper/coll/IntDoubleBinHeap.java:23: The type IntDoubleBinHeap must implement the inherited abstract method BinHeapWrapper<Number,Integer>.isEmpty()
error: graphhopper/core/src/main/java/com/graphhopper/coll/IntDoubleBinHeap.java:23: The type IntDoubleBinHeap must implement the inherited abstract method BinHeapWrapper<Number,Integer>.insert(Number, Integer)
error: graphhopper/core/src/main/java/com/graphhopper/coll/IntDoubleBinHeap.java:23: The type IntDoubleBinHeap must implement the inherited abstract method BinHeapWrapper<Number,Integer>.ensureCapacity(int)
error: graphhopper/core/src/main/java/com/graphhopper/coll/IntDoubleBinHeap.java:23: The type IntDoubleBinHeap must implement the inherited abstract method BinHeapWrapper<Number,Integer>.getSize()
error: graphhopper/core/src/main/java/com/graphhopper/coll/IntDoubleBinHeap.java:23: The type IntDoubleBinHeap must implement the inherited abstract method BinHeapWrapper<Number,Integer>.update(Number, Integer)
error: graphhopper/core/src/main/java/com/graphhopper/coll/IntDoubleBinHeap.java:23: OTPIntDoubleBinHeap cannot be resolved to a type

I can probably bypass the next errors by removing the core/src/main/java/com/graphhopper/reader/OSMFileHeader.java file from the iOS port, since it's using javax.xml.stream.
error: graphhopper/core/src/main/java/com/graphhopper/reader/OSMFileHeader.java:20: The import javax.xml.stream cannot be resolved
error: graphhopper/core/src/main/java/com/graphhopper/reader/OSMFileHeader.java:21: The import javax.xml.stream cannot be resolved
error: graphhopper/core/src/main/java/com/graphhopper/reader/OSMFileHeader.java:22: The import javax.xml.stream cannot be resolved
error: graphhopper/core/src/main/java/com/graphhopper/reader/OSMFileHeader.java:35: XMLStreamReader cannot be resolved to a type
error: graphhopper/core/src/main/java/com/graphhopper/reader/OSMFileHeader.java:35: XMLStreamException cannot be resolved to a type
error: graphhopper/core/src/main/java/com/graphhopper/reader/OSMFileHeader.java:47: XMLStreamReader cannot be resolved to a type
error: graphhopper/core/src/main/java/com/graphhopper/reader/OSMFileHeader.java:47: XMLStreamException cannot be resolved to a type
error: graphhopper/core/src/main/java/com/graphhopper/reader/OSMFileHeader.java:50: XMLStreamConstants cannot be resolved to a variable
error: graphhopper/core/src/main/java/com/graphhopper/reader/OSMFileHeader.java:52: XMLStreamConstants cannot be resolved to a variable

And these errors are pretty obvious and are caused by the changes from the first error block.
error: graphhopper/core/src/main/java/com/graphhopper/routing/DijkstraOneToMany.java:148: The method poll_element() is undefined for the type IntDoubleBinHeap
error: graphhopper/core/src/main/java/com/graphhopper/routing/DijkstraOneToMany.java:175: The method insert_(double, int) is undefined for the type IntDoubleBinHeap
error: graphhopper/core/src/main/java/com/graphhopper/routing/DijkstraOneToMany.java:183: The method update_(double, int) is undefined for the type IntDoubleBinHeap
error: graphhopper/core/src/main/java/com/graphhopper/routing/DijkstraOneToMany.java:193: The method peek_element() is undefined for the type IntDoubleBinHeap
error: graphhopper/core/src/main/java/com/graphhopper/routing/DijkstraOneToMany.java:197: The method poll_element() is undefined for the type IntDoubleBinHeap
error: graphhopper/core/src/main/java/com/graphhopper/routing/DijkstraOneToMany.java:241: The method getCapacity() is undefined for the type IntDoubleBinHeap

Ah, I forgot about this! We introduced a new submodule: https://github.com/graphhopper/graphhopper/tree/master/tools-lgpl with currently just one class. Can you grab just this class somehow?

That did it, thanks.

Thanks too :) !

authors: clns karussell


text:
HTTP requests to external endpoints inside handler functions

Do you want to request a feature or report a bug?
feature
What is the expected behavior?
Is there any way to HTTP request an external endpoint inside a handler function. The objective is to populate a subgraph's schema with information not contained in blockchain. For example a request to another subgraph or another DB.
I've tried importing packages to handle HTTP requests but everything I try throw errors at compile time ('graph build'). I can't even use asyncs functions with awaits.
Thanks in advance

Generally no, this is not possible because arbitrary network requests are not determinstic. But we plan on having ways to compose with other subgraphs.

@leoyvens has there been any change in this approach recently?
There is a large number of NFT projects using centralized metadata endpoints, without access to it, we cant query on chain NFTs based on the offchain metadata information making the subgraph pretty useless. Dynamic NFTs is a thing now so even though that data is not deterministic, we should be able to have it saved on the subgraph so that we can query data based of it.

You can look at Molaris stream event webhook

authors: chrisciszak devarogundade gperezalba leoyvens

repo: graphprotocol/graph-node


text:
chore: rename notice

[ ] update README
[ ] once 1.0 is cut for nexus then cut a @nexus/schema@0.20 from this branch as well.
[ ] close, do not merge

whoops I clicked the wrong button, should not have merged trunk!

whoops I clicked the wrong button, should not have merged trunk! We'll need to revert that. Always forget how to revert merge commits...

Can't you just git revert or git reset --hard <commit before merge> && git push --force ?

Reverted the merges

https://www.npmjs.com/package/@nexus/schema/v/0.20.0
https://www.npmjs.com/package/@nexus/schema/v/0.20.1

authors: Weakky jasonkuhrt

repo: graphql-nexus/schema


text:
Implementation of some websocket utilities in juniper_subscriptions

Has the objective of storing some useful implementation that can be used in the subscriptions implementation over websocket.

@LegNeato I moved the implementation of PR #603 subscriptions from juniper_actix here, I'm not sure if that was what you had proposed to me or if I should put this implementation somewhere else.

Do the changes on latest master supercede this PR?

authors: LegNeato engylemure

repo: graphql-rust/juniper


text:
Input fails on special characters

Description
Input fails and Graphiql becomes completely (almost permanently?) unusable when certain whitespace characters are input
Expected Behaviour
The reverse of the description
Context
When certain whitespace characters are input (I have tested with unicode characters u2000 to u200a, u2028, u202f, could be more) errors are logged to the console (see attached photo), and typing is no longer visible to the user. As it saves the state to localStorage on componentWillUnmount, this makes it almost unusable even after clearing localStorage.clear().
The spec says only tab and space white spaces are accepted, so a better job should be done to handle unaccepted characters.
Possible solution
Perhaps better error handling? Or warning that an invalid character was inserted.

@wizzy25, thanks for opening the issue, let me look into this a bit.

Hello @AGS-, any update on this issue?

repo: graphql/graphiql


text:
Update GraphCMS

Pre-submission checklist:
Please check each of these after submitting your pull request:

[x] Are you only including a repo_url if your project is 100% open source? If so, you need to pick the single best GitHub repository for your project, not a GitHub organization.
[x] Is your project closed source or, if it is open source, does your project have at least 250 GitHub stars?
[x] Have you picked the single best (existing) category for your project?
[ ] Does it follow the other guidelines from the new entries section?
[ ] Have you included a URL for your SVG or added it to hosted_logos and referenced it there?
[ ] Does your logo clearly state the name of the project/product and follow the other logo guidelines?
[ ] Does your project/product name match the text on the logo?
[ ] Have you verified that the Crunchbase data for your organization is correct (including headquarters and LinkedIn)?
[ ] ~10 minutes after opening the pull request, the CNCF-Bot will post the URL for your staging server. Have you confirmed that it looks good to you and then added a comment to the PR saying "LGTM"?

Updated existing GraphCMS entries to update the location field

LGTM

Thanks @ronakganatra!

authors: brianwarner ronakganatra

repo: graphql/graphql-landscape


text:
chore: provide a dumb middleware for testing

PR to Reproduce #17.
Feel free to close when closing issue.
Co-Authored by @Phosphorus-M.

Closing to avoid filling up inbox. This is intended for issue documentation only.

repo: graphul-rs/graphul


text:
Allow users to manually trigger a refresh of their elsewhere accounts

This would avoid issues like #2392. It's not a replacement for #900 which would still be needed to refresh inactive users.
We should throttle the refresh to prevent a user from exhausting our quotas of API calls.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Closing in light of our decision to shut down Gratipay.
Thank you all for a great run, and I'm sorry it didn't work out! 😞  💃

license: mit


text:
Catalog of my Things: Refactor code to avoid rubocop linter errors

In this pull request, I've:

Refactor app.rb file to avoid several rubocop linter errors:

🥇Excellent work Dani!🥇

authors: danifromecuador grauJavier

repo: grauJavier/catalog-of-my-things-ruby


text:
🛑 GrauNeko.com is down

In ea5cf6e, GrauNeko.com (https://graueneko.com) was down:

HTTP code: 403
Response time: 1946 ms

Resolved: GrauNeko.com is back up in f22a654 after 5 hours, 41 minutes.

repo: graueneko/status-page


text:
gateware.usb2: also enter WAIT_TO_SEND if a packet is about to complete

This fixes an issue where the IN transfer manager could get stuck in
state WAIT_FOR_DATA if it entered that state just as a packet was
completing.

Thanks! I got distracted and forgot to commit this after our conversation; so this is especially convenient. ^^

authors: ktemkin miek

repo: greatscottgadgets/luna


text:
Missing Word in John 19:4

Hi Alan,
It looks like there is a missing word in John 19:4:
041904	αυτω	αὐτῷ	RP	...3DMS	αὐτός	8460
041904			D.	.......		37560
041904	ευρισκω	εὑρίσκω	VT	IPA1..S	εὑρίσκω	21470	.”

Looks like οὐχ is missing there.

Added οὐχ.

repo: greekcntr/BHP


text:
add sandbox cookie

This issue tracks adding short-lived sanbox cookie.

Completed.

repo: greenpau/caddy-auth-portal


text:
Sub navigation in sidebar

🚀 Feature Proposal
Sub navigation in sidebar
Motivation
I think it will be great addition to this already awesome theme. This will let us group some articles inside some category inside the section.
Image has been attached for example

Maybe depth can be added in frontmatter to achieve this.
Too much of nesting certainly sound cumbersome to maintian. But at least one more level would be awesome.

Hi, I think it could be a good thing to have it yes! For now sub-sections are listed on the right of the page. Do you mind these sections or others?

Hi, I think it could be a good thing to have it yes! For now sub-sections are listed on the right of the page. Do you mind these sections or others?

I have been using sub section on the right side, which is very useful..
But at times..page gets too long and difficult to navigate..
For such cases having sub menu would be great for page breakdowns

I have been using sub section on the right side, which is very useful..
But at times..page gets too long and difficult to navigate..
For such cases having sub menu would be great for page breakdowns

I think it scales pretty well on big documentations, for example the xstyled one: https://xstyled.dev/docs/installation/.
Sub sections is a good improvement but I am not sure it is a priority.

I think it scales pretty well on big documentations, for example the xstyled one: https://xstyled.dev/docs/installation/.
Sub sections is a good improvement but I am not sure it is a priority.

so you would be open to pr? :)

so you would be open to pr? :)

@poudelprakash yeah why not if it is optional!

@poudelprakash yeah why not if it is optional!

authors: gregberge poudelprakash

repo: gregberge/smooth-doc


text:
upgrade clojure-future-spec to 1.9.0-beta4

The main thing is to migrate from referring to the old clojure.spec namespace to the new
clojure.spec.alpha namespace.

Thanks!

authors: greglook seako

repo: greglook/merkledag-core

license: unlicense


text:
Improve tests and storybook

Is your feature request related to a problem? Please describe.
No.
Describe the solution you'd like
Improve unit and e2e tests, add storybooks.
Describe alternatives you've considered
None.

see #29

repo: gregoranders/ts-react-playground


text:
Build route from coordinates

Hi, @gribnoysup, awesome library. Is there a way to draw a route from point A to point B?

Hi, @binchik! Could you be a little more specific? Maybe a demo in Yandex Maps Sandbox, that I can look at?

@gribnoysup, a user can build routes using RouteEditor control. Is it possible to draw routes programmatically? Here is a demo on jsfiddle:
http://jsfiddle.net/xhwom6aw/

@binchik right now there are no react elements for route, but it is certainly worth adding to the library!
Although it is not possible with some kind of react elements, there is a possible solution, as you always have an access to yandex.maps Map (and any other) instance, the solution could look something like this:
import React from 'react'
import { YMaps, Map } from 'react-yandex-maps'

const mapState = {
  center: [55.751574, 37.573856],
  zoom: 9,
  controls: []
}

class Example extends React.Component {
  constructor() {
    super()
    this.map = null
  }

  onApiAvaliable(ymaps) {
    ymaps.route([
      'Королев',
      { type: 'viaPoint', point: 'Мытищи' },
      'Химки',
      { type: 'wayPoint', point: [55.811511, 37.312518] }
    ], {
      mapStateAutoApply: true
    }).then((route) => {
      route.getPaths().options.set({
        // в балуне выводим только информацию о времени движения с учетом пробок
        balloonContentBodyLayout: ymaps.templateLayoutFactory.createClass('$[properties.humanJamsTime]'),
        // можно выставить настройки графики маршруту
        strokeColor: '0000ffff',
        opacity: 0.9
      });

      // добавляем маршрут на карту
      this.map.geoObjects.add(route);
    });
  }

  render() {
    return (
      <YMaps onApiAvaliable={(ymaps) => this.onApiAvaliable(ymaps)}>
        <Map
          state={mapState}
          instanceRef={(ref) => this.map = ref}
        />
      </YMaps>
    )
  }
}

export default Example

Here is a webpackbin with working example

@gribnoysup, that is super helpful. Thanks!

How to drawing Routing A and B points?

authors: Shakxzod-Namazbaev binchik gribnoysup

repo: gribnoysup/react-yandex-maps


text:
Можно ли закрывать balloon при нажатии на карту

Добрый день!
Использую карту с кластером. Внутри кластера массив Placemark с balloonContentBody.
Соответственно, при нажатии на Placemark открывается balloon с его содержимым. Можно ли при нажатии на карту автоматически закрывать открытый balloon? Не удается разобраться с данным кейсом

@lashevskiy Можно - слушаешь клик по карте и закрываешь балун:

authors: lashevskiy mmarkelov


text:
fix/remove_docker_publish_workflow

In the GitHub actions of the main repository, there is a workflow called docker_publish which does not work for us since we can't log into DockerHub.
I've removed it just for our forked version.
!!! This should not be pushed upstream !!!

Pull Request Test Coverage Report for Build 2069415663

0 of 0   changed or added relevant lines in 0 files are covered.
No unchanged relevant lines lost coverage.
Overall coverage remained the same at 87.347%

Totals

Change from base Build 2051953723:
0.0%

Covered Lines:
6275

Relevant Lines:
7184

💛  - Coveralls

authors: coveralls tretmar

repo: grid-x/ocpp-go


text:
Sort input file list

Sort input file list
so that metadata.json and KVEngine build in a reproducible way
in spite of indeterministic filesystem readdir order.
See https://reproducible-builds.org/ for why this is good.
This PR was done while working on reproducible builds for openSUSE.

Looks good, maintainers merge this! :+1:

Looks good, maintainers merge this! 👍

authors: JohnFulpWillard Redict bmwiedemann

repo: griefly/griefly


text:
How to deposit Grin to exchange via http/https

how to deposit Grin to exchanges via http/https? like a address provided by exchange as below: https://grin.mxc.com/deposit/d99eea26b7c34f0da8419303dd448a96

it's mxc's problem

authors: seahero xiaojay

repo: grinfans/Niffler


text:
[Seção 3] Desenvolver página de sintomas

Escopo: Sintomas
Descrição
Desenvolver seção sintomas, mostrando um sintoma por tela utilizando o swiper para navegar entre cada um. Cada tela deve exibir o ícone (de acordo com assets) e um texto descritivo informando a porcentagem de incidência.
Mockup
Seguir o modelo do layout da tela inicial:

Assets
Ícones

Febre
Tosse
Falta de Ar
Fadiga
Dores no Corpo
Dores de Cabeça
Diarreia
Dor de Garganta
Perda do olfato ou paladar
Náusea ou Vômito
Nariz escorrendo ou entupido

Feito!

authors: JeanCHilger mateusKoppe

repo: grintex/app-covid


text:
Add Polymer API documentation

Add Polymer API documentation to custom elements.

This issue was moved to grislyeye/temp#5

authors: rg-wood rgladwell

repo: grislyeye/vellum-stat-block


text:
Convert swarm-syncable to ES2015

This PR is just a starting point for the discussion about using ES2015 features and about code style in general.
For now it:

Adds babel toolchain.
Converts swarm-syncable to use classes and modules
Changes docstring comment format in swarm-syncable so it can be later used to extract docs with jsdoc toolchain.

All in separate commits.
This PR builds on top of reorg branch.

for example adoption should be made specifically by Host and probably it should be used as an API for constructing objects:

Totally agree with it. As we discussed previously with @gritzko

authors: andreypopp olebedev

repo: gritzko/swarm


text:
correct karye spelling, css and minor adjustments

I changed the titles according to their wishes except for the subpage titles where it would cause other issues
As we discussed with Kinga, I also changed the color distribution (so that the pages with geodata have similar colours) and did some css refactoring
Also adjusted the "Browse the data" menu according to the order of the pages on the index page
I noticed that the symbols in the middle line of the index page are not moving to the side and hovering when moving the mouse over them, but I could not find a reason why they shouldn't so I changed the code accordingly.
Hope these changes are fine!

I saw there are conflicts in the css, I already started to resolve them

I saw there are conflicts in the css, I already started to resolve them

Yes, I needed to change the CSS for the colours of the icon on the list view pages, but shouldn't be too complicated to resolve

authors: kisram rausch-supola

repo: grocerist/grocerist-app


text:
fix: icon misaligned

I noticed that, because of the missing class clickable-icon, the icon was misaligned. This push fix that.

@Lisandra-dev actually it caused the button not to work. I fixed this too, check out commit:
https://github.com/grochowski/obsidian-folder-focus-mode/commit/f5a267d6b19650b19302788316a3664112368907
it expected to have the 'focus-open'/'focus-close' class at the 2 position, which was prone to errors.
added your commit and the fix to 0.9.8 :)

authors: Lisandra-dev grochowski

repo: grochowski/obsidian-folder-focus-mode


text:
fixing the campaign deadline check

(1) In the createCampaign function, the condition campaign.deadline < block.timestamp is incorrect. It should be block.timestamp < _deadline to ensure the deadline is in the future.
(2) Integer Overflow: The amountCollected variable in the Campaign struct and the campaign.amountCollected variable in the donateToCampaign function are not protected against integer overflow. Consider using a SafeMath library to handle arithmetic operations and prevent overflow/underflow issues.
(3) Lack of Event Logging: It's a good practice to emit events for important contract state changes. Consider adding events to log campaign creations and donations, which can make it easier to track and analyze contract activity.
(4) No Validation for Campaign ID: The donateToCampaign and getDonators functions do not validate whether the provided campaign ID is valid. It's important to check if the campaign exists before performing operations on it.
(5) Gas Limit Consideration: The getCampaigns function returns an array of Campaign structs. Depending on the number of campaigns and their size, it can result in exceeding the gas limit for contract execution. Consider splitting this function into paginated or batched retrieval to avoid gas limit issues.
You wrote a briliant contract @LakshaySK106 , please assign me so i can correct possible errors
Assign me this issue @LakshaySK106

All the optimizations and checks were not taken into consideration while writing the contract. You may work on them. I'm assigning this task to you, ATB.

repo: group-patronage/group-patronage


text:
Update README.md

remind the user to install deps if they missed that part earlier on in the readme...helpful for users who are skimming through quickly.

@ehzhang do'h. good catch.

Hi @wjimenez5271! A nit, but do you think you could squash these commits so it doesn't pollute the commit history?
Thanks :)

@ehzhang you bet, see latest update!

:+1:

repo: groupon/greenscreen


text:
Add implementations of the interop tests for cancellation

This is tracking issue to ensure that the implementation of cancellation works from the wrapped apis.

I believe this is done for Python as of the merge of #1668; @soltanmm can correct me if I'm mistaken.

Objective-C cancellation tests were added at #1626 and #1678.

I believe this has been done for all the languages.

authors: jcanizales jtattermusch nathanielmanistaatgoogle tbetbetbe

repo: grpc/grpc


text:
exception thrown from stub code results in server crash

What version of gRPC and what language are you using?
Master C++
What operating system (Linux, Windows, …) and version?
Windows
What runtime / compiler are you using (e.g. python version or version of gcc)
VisualStudio 2015
What did you do?
stub method throws exception:
throw std::exception("Hello");
What did you expect to see?
I expected the client application to get a status != OK with the message "Hello"
What did you see instead?
Server crash.
Anything else we should know about your project / environment?
This works perfectly in the Java server implementation. Server does not crash and the client get a bad status.

When you say "stub code", do you mean the method handler in the service? We
do catch exceptions in the C++ sync server and return them with a failed
status, but we cannot return the content of the exception since it might be
private to the server. You are certainly welcome to wrap your method
handler internal code in a catch block if you need to see the exception
content.
So the crash is surprising to me; can you try running the exception_test on
your system? It's one of our build targets for testing.
On Wed, Mar 7, 2018, 6:59 AM nweidmann notifications@github.com wrote:

What version of gRPC and what language are you using?
Master C++
What operating system (Linux, Windows, …) and version?
Windows
What runtime / compiler are you using (e.g. python version or version of
gcc)
VisualStudio 2015
What did you do?
stub method throws exception:
throw std::exception("Hello");
What did you expect to see?
I expected the client application to get a status != OK with the message
"Hello"
What did you see instead?
Server crash.
Anything else we should know about your project / environment?
This works perfectly in the Java server implementation. Server does not
crash and the client get a bad status.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/grpc/grpc/issues/14622, or mute the thread
https://github.com/notifications/unsubscribe-auth/AIdEkFdH6VabDXbzKcyZyK94jU0WL9aKks5tb_W6gaJpZM4SgmDM
.

Yes, I mean the method handler in my service.
Regarding the fact that you "cannot" return the content of the exception I partially disagree.
I agree regarding unknown exception types, but you could at least catch std::exception and send it's message back to the client application...
I know that the correct way of doing it would be to handle all exception within the application code, but gRPC should guard itself from baldy implemented application code.
I ran my test in debug and there is NO try / catch anywhere in the gRPC framework if you following the stack dump.
Here is my code:
grpc::Status getData(grpc::ServerContext* context, const MyService::DataRequest* request, MyService::DataReply* response)
{
throw std::exception("Hello");
}
And the call stack:

grpc::internal::RpcMethodHandlergRPC::TestService::Service,gRPC::DataRequest,gRPC::DataReply::RunHandler(const grpc::internal::MethodHandler::HandlerParameter & param)
grpc::Server::SyncRequest::CallData::Run(std::shared_ptrgrpc::Server::GlobalCallbacks global_callbacks)
grpc::Server::SyncRequestThreadManager::DoWork(void * tag, bool ok)
grpc::ThreadManager::MainWorkLoop()
grpc::ThreadManager::WorkerThread::Run()

Why not have a try / catch around:
status = func_(....) in grpc::internal::RpcMethodHandlergRPC::TestService::Service,gRPC::DataRequest,gRPC::DataReply::RunHandler
Thanks for your help,
Nicolas

I know your post listed that you're at master, but we do have a try/catch block in master (see https://github.com/grpc/grpc/blob/master/include/grpcpp/impl/codegen/method_handler_impl.h#L40),
which is called from the top function in your stack trace (see https://github.com/grpc/grpc/blob/master/include/grpcpp/impl/codegen/method_handler_impl.h#L67 ). It has been this way for more than a month now (ever since #13815 ). These are protected in code blocks, but the default value is to allow exceptions for all Windows platforms and for Posix platforms where the compiler defines __EXCEPTIONS. Can you check the commit that you're at?
As for the suggestion that we return the error message specified in std::exception back to the client, our original plan was to do that, but it was pointed out in the discussion thread for the exception handling proposal that it's very unsafe to do that. We have no control over what the server method handler has in its exceptions, particularly since the exception could be arbitrary levels deep in a call chain.

I had a lot lately to do and didn't update for a few weeks...
I updated today and everything works fine !
I have read the discussion thread, and the reason you are not forwarding (application) std::exception messages from within the gRPC framework makes 100% sense!
Thanks a lot for your help.
I will close this case.
Have a nice day,
Nicolas

authors: nweidmann vjpai


text:
Basic Tests Python MacOS DNSResolverTest

Seen on #19516
Errors/Failures:
[91munit._dns_resolver_test.DNSResolverTest.test_connect_loopback[0m
[1mtraceback:[0m
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()
  File "/Volumes/BuildData/tmpfs/src/github/grpc/workspace_python_macos_opt_native/src/python/grpcio_tests/tests/unit/_dns_resolver_test.py", line 57, in test_connect_loopback
    timeout=test_constants.SHORT_TIMEOUT,
  File "/Volumes/BuildData/tmpfs/src/github/grpc/workspace_python_macos_opt_native/py27_native/lib/python2.7/site-packages/grpc/_channel.py", line 565, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/Volumes/BuildData/tmpfs/src/github/grpc/workspace_python_macos_opt_native/py27_native/lib/python2.7/site-packages/grpc/_channel.py", line 467, in _end_unary_response_blocking
    raise _Rendezvous(state, None, None, deadline)
_Rendezvous: <_Rendezvous of RPC that terminated with:
	status = StatusCode.DEADLINE_EXCEEDED
	details = "Deadline Exceeded"
	debug_error_string = "{"created":"@1562017691.790340000","description":"Deadline Exceeded","file":"src/core/ext/filters/deadline/deadline_filter.cc","file_line":69,"grpc_status":4}"
>
[1mstdout:[0m

https://source.cloud.google.com/results/invocations/8ac2cce1-bf8d-4c2b-8337-2295d552989b/targets/github%2Fgrpc%2Fpython_macos_opt_native/tests

Interesting. This test is solid green on master. And the only instance of this failure I see on the PR fusion job is on builds for #19516.

And master is still green in the first build after #19516 was merged. Odd.

there's probably some element that's making it flaky

Downgrading to P2 since it apparently hasn't been since in the past 10 days.

Can't find _dns_resolver_test in Basic Tests Python MacOS job anymore, it does exist in Bazel Basic Tests and it's passing, @gnossen can we close this?

authors: XuanWang-Amos gnossen yashykt


text:
CHTTP2 does not ack writes until the syscall finishes

We need to ack these prior to calling into the endpoint to increase possible concurrency.

I have a fix in the works. #2149 progresses this a little.

We now ACK writes as soon as the byte "pass" flow control. This can be closed

authors: ctiller ncteisen


text:
check_linker_need_libatomic() checks system cc instead of user compiler

What version of gRPC and what language are you using?
1.26.0 and local installation of gcc 9.3.0
What operating system (Linux, Windows,...) and version?
Centos8
What runtime / compiler are you using (e.g. python version or version of gcc)
gcc 9.3.0
What did you do?
python2 setup.py install --root=/ --prefix=/tmp/BUILD/lcgcmake-install/grpcio/1.26.0/x86_64-centos8-gcc9-opt
What did you expect to see?
Expect to see normal installation
What did you see instead?
Traceback (most recent call last):   File "setup.py", line 190, in <module>     if check_linker_need_libatomic():   File "setup.py", line 151, in check_linker_need_libatomic     stderr=PIPE)   File "/tmp/BUILD/lcgcmake-install/Python/2.7.16/x86_64-centos8-gcc9-opt/lib/python2.7/subprocess.py", line 394, in __init__     errread, errwrite)   File "/tmp/BUILD/lcgcmake-install/Python/2.7.16/x86_64-centos8-gcc9-opt/lib/python2.7/subprocess.py", line 1047, in _execute_child     raise child_exception OSError: [Errno 2] No such file or directory
GNU GCC doesn't have a symlink cc pointing to gcc and system doesn't have system gcc installed.

@dkonst13 It seems the script cannot find the compiler. Can you try other methods to install gcc (e.g., yum)?
I'm not sure, but have you run make install for your local installation? If so, you might want to dig the parameters of ./configure to fix the local installation.


text:
python client not responding to non-ok error code returned by server

The setting:

Synchronous C++ gRPC server built against gRPC (with bazel) @39650266
Synchronous Python gRPC client using pip installed gRPC (tried 0.13/0.15/1.0rc2)

The problem:
When server returns non-ok code in handler implementation, client gets stuck until timeout (as if response is not received from server).

I verified that we see the proper behavior with a python client and c++ server sending a non-ok status using our interop setup:
https://github.com/grpc/grpc/blob/master/doc/interop-test-descriptions.md#status_code_and_message
Can you include your client side code?

The client code is currently part of a simple integration test, using manually generated stub.

What status code is causing the problem specifically?
Also, could you give the trace for a single gRPC call from both the client and server side?
You can get traces by running with the following environment variable:
GRPC_TRACE='api'

Your Python code looks fine; I don't see any obvious causes of trouble and your problem doesn't correspond to any known defects.

Is the Python client the only client you've written? If you write the client in another language and run it against the same server, do you see the same problem?
How certain are you that you've observed the problem with grpcio 0.13.x, 0.15.x, and 1.0.0rc2? With what version of pip are you installing grpcio? Might I trouble you to use pip freeze to verify that each version you expect to be installed at each stage of your investigation is actually installed? We believe that you will have to pass --pre to pip to install 1.0.0rc2.
Do you see the same problem if you make an asynchronous call and then block on the result (change result = stub.Predict(request, 5.0) to result = stub.Predict.future(request, 5.0).result())?

Some unlikely-to-matter cosmetic things I noticed:

It looks like you generated your code using a 0.14-or-earlier version of the code generator. Consider rerunning the code generator with the latest (also 1.0.0rc2) version of grpcio-tools? If you do rerun the code generator, you'll get two additional classes and one additional function allowing you to upgrade from the Beta API to the GA API. There are no known bugs with the Beta API, but you may prefer to see your code without the word "beta" on every other line.
On line ninety-eight, would that be better as self.assertIn('y', result.outputs)? Would the last two lines of VerifyPredictRequest be better as self.assertSequenceEqual((3.0,), result.outputs['y'].float_val)?

Are we ready to close this as not reproducible ?

@a11r: no.

Resolving after working offline with @fangweili: the problem was that the server was generating a much-too-large status details string.


text:
Channelz, Reset JSON Pointer

Without this the json ended up misformatted

****************************************************************

libgrpc.so

     VM SIZE              FILE SIZE
 ++++++++++++++ GROWIN ++++++++++++++
  [ = ]       0 [None]      +8  +0.0%

  [ = ]       0 TOTAL       +8  +0.0%

****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]

****************************************************************

libgrpc.so

     VM SIZE              FILE SIZE
 ++++++++++++++ GROWIN ++++++++++++++
  [ = ]       0 [None]      +8  +0.0%

  [ = ]       0 TOTAL       +8  +0.0%

****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]

****************************************************************

libgrpc.so

     VM SIZE              FILE SIZE
 ++++++++++++++ GROWIN ++++++++++++++
  [ = ]       0 [None]      +8  +0.0%

  [ = ]       0 TOTAL       +8  +0.0%

****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]

[trickle] No significant performance differences

[trickle] No significant performance differences

[trickle] No significant performance differences

[trickle] No significant performance differences

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,016,509      Total (=)      2,016,509

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,123,086      Total (>)     11,123,082

 No significant differences in binary sizes

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,016,509      Total (=)      2,016,509

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,123,080      Total (<)     11,123,085

 No significant differences in binary sizes

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,016,509      Total (=)      2,016,509

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,123,080      Total (=)     11,123,080

 No significant differences in binary sizes

Corrupt JSON data (indicates timeout or crash):
    bm_call_create.BM_IsolatedFilter_ClientChannelFilter_NoOp_.counters.new: 10
    bm_call_create.BM_IsolatedFilter_ClientChannelFilter_NoOp_.counters.old: 10

[microbenchmarks] No significant performance differences

Corrupt JSON data (indicates timeout or crash):
    bm_call_create.BM_IsolatedFilter_ClientChannelFilter_NoOp_.counters.new: 10
    bm_call_create.BM_IsolatedFilter_ClientChannelFilter_NoOp_.counters.old: 10

[microbenchmarks] No significant performance differences

Corrupt JSON data (indicates timeout or crash):
    bm_call_create.BM_IsolatedFilter_ClientChannelFilter_NoOp_.counters.new: 10
    bm_call_create.BM_IsolatedFilter_ClientChannelFilter_NoOp_.counters.old: 10

[microbenchmarks] No significant performance differences

Objective-C binary sizes
*****************STATIC******************
  New size                      Old size
 2,016,509      Total (=)      2,016,509

 No significant differences in binary sizes

***************FRAMEWORKS****************
  New size                      Old size
11,123,084      Total (>)     11,123,076

 No significant differences in binary sizes

Corrupt JSON data (indicates timeout or crash):
    bm_call_create.BM_IsolatedFilter_ClientChannelFilter_NoOp_.counters.new: 10
    bm_call_create.BM_IsolatedFilter_ClientChannelFilter_NoOp_.counters.old: 10

[microbenchmarks] No significant performance differences

authors: grpc-testing ncteisen


text:
Remove unused code as comment

This slipped through the crack in #19787. Removing unused targets.
Also include the temporary build files in .gitignore

Errors are unrelated. Merging


text:
Implement compute_engine_channel_credentials in Python

This introduces a compute_engine_channel_credentials() function in Python as well as a grpc_compute_engine_channel_credentials_create function in Core that may be used for other wrapped languages. This enables Directpath support.
This can be tested with
bazel run  //src/python/grpcio_tests/tests/interop:client -- --server_host=$ENDPOINT --server_port=443 --custom_credentials_type=compute_engine_channel_creds --grpc_test_use_grpclb_with_child_policy=round_robin

in a directpath-capable environment.

CC @weiranfang

Thank you @gnossen for implementation. I realized that the naming of grpc_compute_engine_channel_credentials_create is a little bit confusing. What you create here is just a composite channel creds from SSL and ALTS creds without any call creds. I think grpc_google_default_channel_credentials_create is a better name.
Also, it make sense just put the implementation in the same file as in google_default/google_default_credentials.cc. Basically, google_default_credentials.cc has both grpc_google_default_channel_credentials_create() (composite from SSL and ALTS creds) and grpc_google_default_credentials_create() (composite from SSL and ALTS creds + call creds). This would also solve the g_is_on_gce problem.
@markdroth @apolcyn WDYT?

Thank you @gnossen for implementation. I realized that the naming of grpc_compute_engine_channel_credentials_create is a little bit confusing. What you create here is just a composite channel creds from SSL and ALTS creds without any call creds. I think grpc_google_default_channel_credentials_create is a better name.

As I mentioned above, I think we should just add an optional parameter to the existing factory function instead of adding a second one.

Also, it make sense just put the implementation in the same file as in google_default/google_default_credentials.cc. Basically, google_default_credentials.cc has both grpc_google_default_channel_credentials_create() (composite from SSL and ALTS creds) and grpc_google_default_credentials_create() (composite from SSL and ALTS creds + call creds). This would also solve the g_is_on_gce problem.

I agree that the implementation should be in the same file as the existing function.

@markdroth If that's the case, I'm fine with submitting a gRFC and updating the signature and call sites of grpc_google_default_channel_credentials_create.
@yihuazhang @apolcyn Does this approach work for you? Since the functionality I'm looking for here is a Google default credential without any call credential at all, it seems reasonable not to include "compute engine" in the name.

@yihuazhang @apolcyn Does this approach work for you? Since the functionality I'm looking for here is a Google default credential without any call credential at all, it seems reasonable not to include "compute engine" in the name.

Yes, an optional parameter on the the existing C-core API to allow specifying custom call creds seems reasonable to me.

@yihuazhang @apolcyn Does this approach work for you? Since the functionality I'm looking for here is a Google default credential without any call credential at all, it seems reasonable not to include "compute engine" in the name.

Yes, an optional parameter on the the existing C-core API to allow specifying custom call creds seems reasonable to me.

Sorry for mis-clicking! It SGTM to update the existing C-core API to support both cases.

gRFC for Mark's suggestion is up.

Converting back to draft to implement the suggested changes as outlined in the gRFC.

@apolcyn @markdroth
Updated as outlined in the gRFC. PTALA.

@markdroth Yes. I'm planning to add Lidi as a reviewer once the Core changes are hammered out. Thanks for the review! It should be ready for another look.

@lidizheng PTALA

@apolcyn @yihuazhang I'd like one final look from you, please.

It seems we call update_tenancy() (especially the part detecting the availability of metadata server) even in a situation when a call credential is not retrieved from a metadata server (e.g., read from local file). It is different from the original behavior, and needs to be fixed.

@yihuazhang Checking GCE tenancy is necessary to use ALTS in the security connector unless we want to get rid of the check for GCE tenancy there.
I've decoupled the tenancy check from the metadata server reachability check so that we do not attempt to contact the metadata server unless we intend to retrieve a call credential from it. PTALA.

Instead, I think we should check if alts_creds_ == nullptr because if the code is not running on GCE, this line should return nullptr.

I think this sounds sensible. I do think that checking tenancy within the GDC security connection creation seems redundant with whats ALTS credentials already do.

To make sure we're all on the same page, it sounds like we want to:

Update g_is_on_gce only in the case that we're following the old, default codepath where not call credential is specified.
Remove the check of g_is_on_gce in the security connector creation code
Instead, allow the ALTS code to check if we're on GCE by checking if we failed to create the ALTS channel credential.

SG. I think we can further get rid of g_is_on_gce if using the check on alts_creds_ in create_security_connector().

@apolcyn @yihuazhang Updated according to the comments above. PTALA.

@yihuazhang @apolcyn So there's a problem with using grpc_alts_credentials_create() == nullptr as a check to determine whether the process is running on GCE. This call may return nullptr for reasons besides not running on GCE. For example, when running on Mac. The current behavior in this situation is to set alts_creds_ to nullptr but return a valid google_default_credentials object. Then, if is_grpclb_load_balancer or is_backend_from_grpclb_load_balancer evaluates to true, the credential will fail later, when constructing the security connector.
Is it a valid to use google default creds on MacOS but never use ALTS (i.e., only use SSL)? If so, the current method of detecting presence on GCE will not work and we'll need to switch back to the previous method or create some other mechanism for distinguishing between lack of platform support and presence outside of GCE.
If we believe that this was never a valid usage, then I can just change the unit tests so that we enforce different expectations on these unsupported platforms.

@yihuazhang @apolcyn So there's a problem with using grpc_alts_credentials_create() == nullptr as a check to determine whether the process is running on GCE. This call may return nullptr for reasons besides not running on GCE. For example, when running on Mac. The current behavior in this situation is to set alts_creds_ to nullptr but return a valid google_default_credentials object. Then, if is_grpclb_load_balancer or is_backend_from_grpclb_load_balancer evaluates to true, the credential will fail later, when constructing the security connector.

This described behavior actually sounds correct to me. Note that running on Mac does qualify as "not running on GCE" :)

Is it a valid to use google default creds on MacOS but never use ALTS (i.e., only use SSL)? If so, the current method of detecting presence on GCE will not work and we'll need to switch back to the previous method or create some other mechanism for distinguishing between lack of platform support and presence outside of GCE.

Macos to prod using google default credentials is a valid use case. Also, we have an interop test that actually does test Macos to prod (as a way of testing "outside GCE" to prod), which is invoked here: https://github.com/grpc/grpc/blob/b158eb79f8498ffd405c86a7cda2d2d81d9a7474/tools/internal_ci/macos/grpc_interop_toprod.sh#L34. The test description is here: https://github.com/grpc/grpc/blob/master/doc/interop-test-descriptions.md#google_default_credentials.
ALTS only works if the environment has ALTS handshake server support (like on GCE). Note the basic thing that protects from the alts_creds_ == nullptr code path from happening is actually that DNS name resolution for google services does not resolve grpclb addresses unless DirectPath is available.

This PR causes issues when importing. I think we need to update grpc-swift too.

authors: apolcyn gnossen jiangtaoli2016 markdroth yashykt yihuazhang


text:
interop: Update Go interop build scripts.

Summary of changes:

Change the base image to use Go1.15, which is the latest version
Use go get -d to download the gRPC-Go package. This is the preferred
way of downloading packages in the module-aware Go ecosystem.
Remove calls to make deps and make testdeps which have been
removed from gRPC-Go repo.

@donnadionne

Is this a change-detector test?
Traceback (most recent call last):
  File "tools/buildgen/generate_projects.py", line 108, in <module>
    assert 0 == os.system('diff %s %s' % (s, g)), s
AssertionError: ./tools/dockerfile/interoptest/grpc_interop_go/build_interop.sh

Is this a change-detector test?
Traceback (most recent call last):
  File "tools/buildgen/generate_projects.py", line 108, in <module>
    assert 0 == os.system('diff %s %s' % (s, g)), s
AssertionError: ./tools/dockerfile/interoptest/grpc_interop_go/build_interop.sh

Not really,  the build_interop.sh script is actually generated from a template (https://github.com/grpc/grpc/blob/master/templates/tools/dockerfile/interoptest/grpc_interop_go/build_interop.sh.template#L3) (I think to avoid duplication) and the tests is basically complaining about the generated file being updated, but the template staying out-of-date.
Turns out there are more images that build grpc-go https://github.com/grpc/grpc/search?q=go_build_interop.sh.include

@easwars  since some changes in this PR are questionable, let's first identify the grpc-go PR that broke the build and roll back (to make tests green again asap). Then we can talk about the right way of updating the go interop build.

@jtattermusch
Thanks for your feedback.
I have reverted the Makefile changes made earlier. See: https://github.com/grpc/grpc-go/pull/4060
Will wait for the interop tests to turn green before attempting to switch the container image to Go1.15.

authors: dfawley easwars jtattermusch


text:
Update test creds to have 10 year expiry

Test creds initially only had the default expiry, which are already expired.
Changes:

Add test creds

We've verified manually that the cherry-picking passed the internal build. Merging now...

authors: ZhenLian krestofur


text:
Release callback function before unreferencing call

The lifetime of the callback function exceeded that of the call reference.

I do not see any difference in behavior...

authors: eugeneo ywelsch


text:
Port https://github.com/grpc/grpc-go/pull/6686 to C++

This fixes connecting to a local ATLS server with grpc_cli.

Is the PHP MacOS error related to this change?

The failing tests seem unrelated and appear to be flaky.


text:
Remove pip install six where it should not be necessary

Followup for https://github.com/grpc/grpc/pull/5167.

Distributions tests are still passing.
https://grpc-testing.appspot.com/view/Artifacts/job/gRPC_distribtest/65/architecture=x64,language=python,platform=linux/console
Fedora21 problem is unrelated.

Actually, no. It's breaking the distrib tests:
pkg_resources.VersionConflict: (six 1.9.0 (/usr/lib/python2.7/site-packages), Requirement.parse('six>=1.10'))
https://grpc-testing.appspot.com/job/gRPC_distribtest/66/architecture=x64,language=python,platform=linux/console

https://grpc-testing.appspot.com/job/gRPC_distribtest/66/architecture=x64,language=python,platform=linux/console

for some reason, if you don't manually do pip install --upgrade six before installing, the distribtests fail (despite six>=1.10 being mentioned in requirements.txt).

friendly ping, any opinions on this?

Maybe six is already installed and without the --upgrade flag the python distribution gets confused because it's owned by the system (although then that'd mean --ignore-installed would be required? except I'm not sure if that's required or not for certain versions of pip?)?
My basic diagnosis is that six is not owned by pip, so pip can't upgrade it. I just don't understand why it was then working with the --upgrade flag as opposed to the --ignore-installed flag.

authors: jtattermusch soltanmm


text:
Fix bugs in UV DNS resolver implementation

This should fix the connectivity problems reported in GoogleCloudPlatform/google-cloud-node#1946. The corresponding issue in this repo is #9518.

The linux test is fixed in #9527. The mac failure is #9389. The Windows failure is #9088. And the interop failure is grpc/grpc-java#2680.