ajax-panel icon indicating copy to clipboard operation
ajax-panel copied to clipboard

rsp.headers is not a function ERROR

Open vinilima07 opened this issue 5 years ago • 10 comments
trafficstars

My grafana version is 6.7.0 My ajax plugin is the latest. I am trying to use the plugin and i am getting the error in dev tools console after call a post request, the request is sent normally and the response is get normally to.

image

This is making the ajax plugin to not render the message that is sent on response but after i click in grafana refresh button the previous message is rendered.

vinilima07 avatar Jun 05 '20 15:06 vinilima07

Dear Vinicius,

this is probably a duplicate of #60 and might have been fixed through #64 already. If you will be able to build this plugin for yourself, it might help you along.

With kind regards, Andreas.

amotl avatar Jun 05 '20 18:06 amotl

@amotl Thank you so much, so, until they merge the commit with master i did the same modifications in the file that the commit do, but i am having problem building the plugin: This is my error, any orientation will be very helpful. image

the error is showed up after i run: yarn build

vinilima07 avatar Jun 05 '20 19:06 vinilima07

Dear Vinicius,

I just tried and had no problems building the vanilla master using yarn install followed by yarn build.

The Prettier is sometimes a bit picky, so it might just be this guy complaining.

You might well want to directly clone https://github.com/BlackLight/ajax-panel. Thanks again for the fix, @BlackLight.

With kind regards, Andreas.

amotl avatar Jun 05 '20 20:06 amotl

Indeed, after switching to @BlackLight's fork, I am also getting (different) errors:

  ERROR in /Users/amo/dev/panodata/sources/ajax-panel/src/module.ts
  [tsl] ERROR in /Users/amo/dev/panodata/sources/ajax-panel/src/module.ts(499,31)
        TS2554: Expected 1 arguments, but got 0.

  ERROR in /Users/amo/dev/panodata/sources/ajax-panel/src/module.ts
  [tsl] ERROR in /Users/amo/dev/panodata/sources/ajax-panel/src/module.ts(507,18)
        TS2349: This expression is not callable.
    Type 'typeof import("/Users/amo/dev/panodata/sources/ajax-panel/node_modules/@grafana/data/index")' has no call signatures.

amotl avatar Jun 05 '20 20:06 amotl

Dear Vinicius,

[1] fixes the build for me. However, I haven't tested it on a real Grafana instance.

With kind regards, Andreas.

[1] https://github.com/panodata/ajax-panel/tree/fixfixfix

amotl avatar Jun 05 '20 21:06 amotl

Dear @amotl , I tried to use BlackLigh solution, but for me this modifications only remove the 'type function error'. So i made some modifications based on this https://github.com/ryantxu/ajax-panel/issues/60#issuecomment-626465545 This modifications was a solution to Panel refresh problem, now when he receive the response from server he is refreshed, it wasn't happening before. I will post my solution and make a pull request as soon as i can.

Again, thank you very much!

vinilima07 avatar Jun 05 '20 21:06 vinilima07

I made a solution for this issue and two other issues i think! https://github.com/ryantxu/ajax-panel/issues/60#issue-591703784 https://github.com/ryantxu/ajax-panel/issues/65#issue-628320015 my repo: https://github.com/viniciusfdev/ajax-panel.git

@robertpascale i think this will help you!

vinilima07 avatar Jun 05 '20 22:06 vinilima07

Hi @viniciusfdev , That's great - but I'm not sure how I can use your patch. I currently run grafana in a docker container on a NAS box, and I just add the plugin via the docker environment variable as follows: GF_INSTALL_PLUGINS=ryantxu-ajax-panel I don't have any way of compiling my own and even if I did, I'm not sure how I would embed it in the docker container. Hopefully @ryantxu may action the pull request and roll it in to the next production release.

robertpascale avatar Jun 06 '20 08:06 robertpascale

Dear @robertpascale, I'm also running grafana on the docker, if you really need this fix as early as I do, just clone my repository, install all the dependencies needed to create the grafana plugin like @ grafana / tools and yarn, run 'yarn install' and 'yarn build ', doing this, a folder called' dist 'will appear, the' dist 'folder is used by grafana to create a plugin, so you need to put this' dist' folder inside another folder as' ajax-plugin 'and put inside the directory / data / plugis in the grafana container (with docker cp or using volumes).

vinilima07 avatar Jun 07 '20 17:06 vinilima07

running into this with grafana 7.1.1

kavdev avatar Oct 16 '20 18:10 kavdev