Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with release build #17

Open
chrisdlangton opened this issue May 9, 2020 · 7 comments
Open

Issue with release build #17

chrisdlangton opened this issue May 9, 2020 · 7 comments
Labels
bug Something isn't working
Milestone

Comments

@chrisdlangton
Copy link

chrisdlangton commented May 9, 2020

Trying Github.com API https://developer.github.com/v4/guides/forming-calls/#authenticating-with-graphql

On Grafana v6.7.3 (a04ef6cefc)

Getting

GraphQL Data Source plugin failed
Error: [$injector:unpr] Unknown provider: rProvider <- r http://errors.angularjs.org/1.6.9/$injector/unpr?p0=rProvider%20%3C-%20r

No idea what any of that means.

It occurs int he GUI when i chose your GraphQL Data Source, toggle Basic Auth, add the token and bearer in the Basic Auth Details, click Save & Test.

To replicate you can do exactly what i did with a fresh install like this;

docker-compose.yaml

version: '3.6'
x-defaults: &defaults
  restart: unless-stopped
  logging:
    options:
      max-size: "10m"
      max-file: "3"
  cap_drop:
    - ALL
  cap_add:
    - DAC_OVERRIDE

services:
  dashboard:
    <<: *defaults
    image: bitnami/grafana:6-debian-10@sha256:bda98953d622ff2c10ffd0bcbf3c71eb7eaf3222281c5ab2dc5e3b2d2cafcc3e
    container_name: dashboard
    build:
      context: ./
      dockerfile: docker/Dockerfile
    user: "${UID}"
    environment:
      - GITHUB_PERSONAL_ACCESS_TOKEN=${GITHUB_PERSONAL_ACCESS_TOKEN}
      - GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD}
      - GF_INSTALL_PLUGINS=${GF_INSTALL_PLUGINS}
    ports:
     - 3000:3000
    volumes:
      - ./grafana-persistence:/opt/bitnami/grafana/data/
      - ./docker/grafana/conf/custom.ini:/opt/bitnami/grafana/conf/custom.ini

The .env like this

GF_SECURITY_ADMIN_PASSWORD=bitnami
GF_INSTALL_PLUGINS=graphql-datasource=https://github.com/fifemon/graphql-datasource/archive/v1.1.0.zip
UID=1000

Makefile if you need it, closes some gaps..

SHELL := /bin/bash
include .env
export $(shell sed 's/=.*//' .env)

.PHONY: help

help: ## This help.
	@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

.DEFAULT_GOAL := help

prerequisites:
	touch .env
	mkdir -p docker/grafana/conf grafana-persistence
	docker run -td --rm --name temp --entrypoint tail bitnami/grafana:6-debian-10@sha256:bda98953d622ff2c10ffd0bcbf3c71eb7eaf3222281c5ab2dc5e3b2d2cafcc3e -f /dev/null
	docker cp temp:/opt/bitnami/grafana/conf/grafana.ini ./docker/grafana/conf/custom.ini
	docker stop temp

target: prerequisites

build:
	docker-compose build --no-cache

run:
	docker-compose up -d --force-recreate

stop:
	docker-compose down

backup:
	rsync -a ./grafana-persistence ./grafana-persistence.bkp.$(date +%Y%m%d-%H.%M.%S)

Any help would be appreciated, happy to work on a fix myself and PR if i can get some guidance.

EDIT: same error with your API https://bahnql.herokuapp.com/graphql

@retzkek
Copy link
Contributor

retzkek commented May 11, 2020

Thanks for the detailed report. It seems to be an issue with a release build. Try using this dev build instead: https://github.com/fifemon/graphql-datasource/archive/v1.1.0-dev.zip
I've reached out to Grafana devs for help.
I have the dev build marked as the current release, and deleted the tag for the release build.

@retzkek retzkek added the bug Something isn't working label May 11, 2020
@retzkek retzkek changed the title Issue with basic auth for github api Issue with release build May 11, 2020
@michaelneale
Copy link
Contributor

michaelneale commented Jun 22, 2020

ok took a closer look, following instructions with https://grafana.com/tutorials/build-a-data-source-plugin/#3 - I was able to build a plugin that was able to run minified, so I am not sure if there is a config problem with this, or a bug in something doing the minified version ... doesn't look like anything obvious that I tried ...

(I tried changing the dependencies to match, removing the runtime dependency and other things, to no avail).

@michaelneale
Copy link
Contributor

hey @retzkek yeah had a few goes, and couldn't not see anything in the config that would cause this. Am I right in assuming that you used https://grafana.com/tutorials/build-a-data-source-plugin/ to create the plugin scaffolding?

A simple plugin worked with build, but not the graphql one. Based on past experience, there are certain things that can trip up minification for the build dist, however in this case that seems to be done by "build": "grafana-toolkit plugin:build" in the script section, so I can't see anything else that would do it. So I think asking grafana devs for tips may help... (otherwise moving things bit by bit in a new plugin until it breaks... but not sure if that will work... will see).

I also saw this: https://grafana.com/docs/grafana/latest/developers/plugins/backend/ I wonder if they will steer data source plugin in that direction?

@retzkek
Copy link
Contributor

retzkek commented Jun 23, 2020

Thanks, so it's not just me :)

Am I right in assuming that you used https://grafana.com/tutorials/build-a-data-source-plugin/ to create the plugin scaffolding?

No, I started this before that tutorial existed. I actually started from https://github.com/grafana/simple-datasource, which was also in progress when I started. So yeah maybe starting a "new" plugin is the way to go.

I also saw this: https://grafana.com/docs/grafana/latest/developers/plugins/backend/ I wonder if they will steer data source plugin in that direction?

That's a good point, especially to be able to support alerting...

@michaelneale
Copy link
Contributor

in any case, for now this works as it is.. but worthwhile revisiting at some point.

@svet-b
Copy link

svet-b commented May 4, 2021

@retzkek just curious whether you got any feedback from the Grafana dev team on what might be causing this?

Given that yarn dev works just fine, and the rest should mostly just be minification, naively it would seem like there should be a fairly simple explanation (famous last words...)

@retzkek
Copy link
Contributor

retzkek commented May 4, 2021

No, I never got an answer, but I also never really got anyone to take a deep look. I've basically given up on this issue, and am just starting from scratch with a newly-generated backend plugin for v2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants