Forum Discussion
Editing/Modifying an Existing Custom Visual
- 5 years ago
Hey Anonymous,
When you say you have only changed the guid, does this include backing-out the minor changes you wanted to make? I'd be inclined to stash those somewhere and confirm the base visual works from checkout before packaging with the changes. The visual host suppresses runtime errors and a blank visual can also be a side-effect of such a runtime error.
Assuming you have and the guid is the only change, then my next steps to investigate would be as follows:
If you're still getting a smaller package size it sounds to me like the newer SDK is somehow still installed. Is it possible that you may have installed powerbi-visuals-tools locally to the project as well as globally? You can check this as follows:
- Confirm that package.json doesn't contain powerbi-visuals-tools in either dependencies or devDependencies.
- If it does, type npm un powerbi-visuals-tools and press [Enter].
- Confirm the entry is removed from package.json.
I'm unfortunately not in a position where I can confirm the below process will work as I have several active visual projects on the go and I can't downgrade at this time, but this used to be my process:
- In the command prompt, type npm un powerbi-visuals-tools -g and press [Enter].
- Type pbiviz and press [Enter] - this should return an error as tools should be uninstalled.
- Re-attempt the install: type npm i [email protected] -g and press [Enter].
- Once installed, type pbiviz --version and press [Enter]. This should say 1.13.x (where x will be a minor version - according to npm the latest build under 1.13 is 1.13.1 so will likely be that - as long as it's 1.13 we should be good).
- The older version of the SDK has a 2-step cert process.
- First type pbiviz --create-cert and press [Enter]. This will generate the file. Make note of the key.
- Then type pbiviz --install-cert and press [Enter]. This should present the standard dialog where you can install the cert. Add in your key here as normal (remeber that the cert needs to be installed into Trusted Root Certification Authorities).
It also looks like Mapbox has their own additional steps for the dev process. It's possible if these aren't done in the right order then they might cause issues also. I would attempt the following to ensure that your checkout corresponds correctly:
- Type npm i and press [Enter].
- Type npm run build-turf and press [Enter].
Confirm that your pbiviz.json still shows "1.13.0" under the apiVersion property.
As long as pbiviz.json and the tools are in sync then pbiviz package or pbiviz start should bundle correctly.
If the guid is the only change you've made to the checkout then theoretically that should be all there is to it. If the code, minus this one change doesn't work then I would suggest creating an issue with Mapbox for advice on how to set-up the development environment correctly to match their own.
You could also try asking the visuals team at MS directly, as they don't weigh-in on the forums any more: [email protected]. it is however possible they will direct you to Mapbox for support.
Regards,
Daniel
- 5 years ago
On the older SDK, the apiVersion isn't tied to a sensible repository like npm and is managed through some other arcane means, so there are some manual steps.
BTW updating your SDK and API to 2.6.0 should be okay as this is as far as you can go on the older tooling before needing to migrate packages and code to the newer tooling.
On the older tooling, the specified apiVersion in pbiviz.json needs to be pulled down separately and stored in your project's .api folder if you update the tools in-place.
As long as you have powerbi-visuals-tools 2.6 installed, you should be able to run the following from the command line:
pbiviz update 2.6.0This should set the apiVersion to 2.6.0 in pbiviz.json and a pbiviz start should hopefully not complain about SDK and API being out of whack.
You will also need to re-generate the certificate on the older versions if you either update the API or the tools due to a change in signature of the SDK + API.
If it's still upset, check the .api folder of your project and delete any that aren't relevant to your current specified API version. The tool should do this itself but it's possible that errant ones may remain if you've been shifting between versions.
On the newer toolchain there are separate npm packages for the API and tools so its easier to manage, and certificates only have to be generated for new versions of powerbi-visuals-tools (updating powerbi-visuals-api is safe).
The older tooling was still evolving and a lot of existing visuals still use it, which unfortunately does make experiences like these commonplace, if you're picking up someone else's work. You definitely get a better experience if you attempt to work on anything with an SDK >= 3.1.
Hopefully this should get you on track,
Daniel
Hi dm-p ,
Thank you very much for your help and reply.
I've tried the steps that you've mentioned for the 2nd option (Since I only need several minor adjustments to the existing Mapbox visual)
npm i [email protected] -g
and gave it a new GUID, then I tried packaging it with "npm run package" at the root of the mapbox directory, but for some reason, the newly generated .pbiviz file still comes up as 330 Kb (and it didn't work on the Desktop version).
I've also tried creating/installing a certificate for the 1.13 version with pbiviz -- create-cert and pbiviz --install-cert , but when I tried to run it using the Developer mode, it wouldn't work either.
Please note that I haven't made any changes to the actual code outside of the GUID.
Have I missed out anything else? Thanks
Hey Anonymous,
When you say you have only changed the guid, does this include backing-out the minor changes you wanted to make? I'd be inclined to stash those somewhere and confirm the base visual works from checkout before packaging with the changes. The visual host suppresses runtime errors and a blank visual can also be a side-effect of such a runtime error.
Assuming you have and the guid is the only change, then my next steps to investigate would be as follows:
If you're still getting a smaller package size it sounds to me like the newer SDK is somehow still installed. Is it possible that you may have installed powerbi-visuals-tools locally to the project as well as globally? You can check this as follows:
- Confirm that package.json doesn't contain powerbi-visuals-tools in either dependencies or devDependencies.
- If it does, type npm un powerbi-visuals-tools and press [Enter].
- Confirm the entry is removed from package.json.
I'm unfortunately not in a position where I can confirm the below process will work as I have several active visual projects on the go and I can't downgrade at this time, but this used to be my process:
- In the command prompt, type npm un powerbi-visuals-tools -g and press [Enter].
- Type pbiviz and press [Enter] - this should return an error as tools should be uninstalled.
- Re-attempt the install: type npm i [email protected] -g and press [Enter].
- Once installed, type pbiviz --version and press [Enter]. This should say 1.13.x (where x will be a minor version - according to npm the latest build under 1.13 is 1.13.1 so will likely be that - as long as it's 1.13 we should be good).
- The older version of the SDK has a 2-step cert process.
- First type pbiviz --create-cert and press [Enter]. This will generate the file. Make note of the key.
- Then type pbiviz --install-cert and press [Enter]. This should present the standard dialog where you can install the cert. Add in your key here as normal (remeber that the cert needs to be installed into Trusted Root Certification Authorities).
It also looks like Mapbox has their own additional steps for the dev process. It's possible if these aren't done in the right order then they might cause issues also. I would attempt the following to ensure that your checkout corresponds correctly:
- Type npm i and press [Enter].
- Type npm run build-turf and press [Enter].
Confirm that your pbiviz.json still shows "1.13.0" under the apiVersion property.
As long as pbiviz.json and the tools are in sync then pbiviz package or pbiviz start should bundle correctly.
If the guid is the only change you've made to the checkout then theoretically that should be all there is to it. If the code, minus this one change doesn't work then I would suggest creating an issue with Mapbox for advice on how to set-up the development environment correctly to match their own.
You could also try asking the visuals team at MS directly, as they don't weigh-in on the forums any more: [email protected]. it is however possible they will direct you to Mapbox for support.
Regards,
Daniel
- Anonymous5 years agoNot applicable
Hi dm-p
Thank you once again for your informative reply, I really appreciate it.
I cloned a fresh copy of the latest repository and I've followed all your steps and I did miss out the npm run build-turf step.
I had a few issues and found out that the build-turf they mentioned in their instructions was actually turf-build.
However, after correcting this - I attempted to run it as-is (i.e. no changes, not even the GUID this time) using pbiviz start would give the following error:
The pbiviz --version states 1.13.1 and the apiVersion in the pbiviz.json states 1.13.0.
I found out from this post in their GitHub issues, https://github.com/mapbox/mapboxgl-powerbi/issues/347 , that someone had similar issues - the developer did respond (one of the last responses since then) and mentioned npm install -g [email protected] .
I tried upgrading to 2.6.0 as well, but it still complained about the Invalid API v1.13.0.
Is it possible there's some sort of mismatch with the API version? Would I have to change the information in the pbiviz.json or other files?
Thanks again
- dm-p5 years ago
Super User
On the older SDK, the apiVersion isn't tied to a sensible repository like npm and is managed through some other arcane means, so there are some manual steps.
BTW updating your SDK and API to 2.6.0 should be okay as this is as far as you can go on the older tooling before needing to migrate packages and code to the newer tooling.
On the older tooling, the specified apiVersion in pbiviz.json needs to be pulled down separately and stored in your project's .api folder if you update the tools in-place.
As long as you have powerbi-visuals-tools 2.6 installed, you should be able to run the following from the command line:
pbiviz update 2.6.0This should set the apiVersion to 2.6.0 in pbiviz.json and a pbiviz start should hopefully not complain about SDK and API being out of whack.
You will also need to re-generate the certificate on the older versions if you either update the API or the tools due to a change in signature of the SDK + API.
If it's still upset, check the .api folder of your project and delete any that aren't relevant to your current specified API version. The tool should do this itself but it's possible that errant ones may remain if you've been shifting between versions.
On the newer toolchain there are separate npm packages for the API and tools so its easier to manage, and certificates only have to be generated for new versions of powerbi-visuals-tools (updating powerbi-visuals-api is safe).
The older tooling was still evolving and a lot of existing visuals still use it, which unfortunately does make experiences like these commonplace, if you're picking up someone else's work. You definitely get a better experience if you attempt to work on anything with an SDK >= 3.1.
Hopefully this should get you on track,
Daniel
- Anonymous5 years agoNot applicable
Hi dm-p ,
Thank you very much again for your help!
I've finally managed to get it up and running with your guidance - The map itself isn't working/rendering yet (I'll take a look into this tomorrow), but Power BI seems to recognise the Format Options and everything else.
Thank you again, really appreciate it!