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

Error while trying to upload a pbix file to powerbi server #304

Open
sridharallada opened this issue Nov 17, 2020 · 9 comments
Open

Error while trying to upload a pbix file to powerbi server #304

sridharallada opened this issue Nov 17, 2020 · 9 comments

Comments

@sridharallada
Copy link

Do you want to request a feature or report a bug?
bug

What is the current behavior?
Error while trying to upload a large .pbix file(size >300MB) to Powerbi server using the powershell script Write-RsRestCatalogItem..The script is working fine for .pbix file sizes <200mb apprx.Looks ther eis some problem at Invoke-webrequest ...Parameter body in invokewebrest is unable to handle the bytes.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
Write-RsRestCatalogItem -WebSession $session -Path $PBIXFile -RsFolder $DeploymentFolderLocation -Verbose -Overwrite

Write-RsRestCatalogItem : System.Exception: Failed to create catalog item: The remote server returned an error: (422) Unprocessable Entity. ---> System.Net.WebException: The remote
server returned an error: (422) Unprocessable Entity.
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
--- End of inner exception stack trace ---

  • Write-RsRestCatalogItem -WebSession $session -Path $PBIXFile -RsFolde ...
  •   + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
      + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-RsRestCatalogItem
    
    

What is the expected behavior?
Should upload without issues

Which versions of Powershell and which OS are affected by this issue? Did this work in previous versions of our scripts?
All powershell versions and windows 10.

@sridharallada
Copy link
Author

Hi Jaime,
CAn you please consider it as bug and provide the resolution?Our powerbi files are more than 300 MB and we are facing issues.
Is it the expected behaviour for large files?

@jtarquino
Copy link
Member

There is a different api for large files which will need the implementation for large files, we do welcome community contributions to add additional functionality

@jtarquino jtarquino reopened this Nov 18, 2020
@sridharallada
Copy link
Author

Hi Jaime,
Thanks for your response.Is it possible to give us any timeframe to implement this api for large files?.We are struck with this for now.?

@jtarquino
Copy link
Member

Improvements in the commands are provided by the open source community, I encourage you to add the new feature and send a Pull Request for it

@sridharallada
Copy link
Author

I would suggest to categorise the issues a bug since its not working.We have tried a lot to fix the issue but no use.It would be better if we can reach out to the person who has implemented this module so tht he can better understand the issue and can resolve quickly.

@okpedro
Copy link

okpedro commented Nov 25, 2020

Sridhar, I think there's a little bit of confusion here. When you asked if it is possible to give you a timeframe on when this API will be implemented... it already is implemented. If you go try to upload a 100KB Power BI .pbix file with your browser on the PBIRS portal and inspect the traffic of your upload, you'll notice that the "/Reports/api/v2.0/catalogitems" endpoint is used to upload your file. Try to upload a 512MB file and you'll notice that the endpoint your browser will hit changes to something like "/Reports/api/v2.0/PowerBIReports(Path={})/Model.Upload."

If you look at the API documentation here and look up the documentation for ​/DataSets({Id})​/Model.Upload, you'll see the definition says it "does an efficient binary upload of a new or existing DataSet CatalogItem from a multipart/form-data request. Use of this API is recommended for files larger than 25 MB in size." This is the endpoint you want! It's exists! It's real and you're ALREADY USING IT!

This PowerShell library is something called an "API wrapper"--it simply wraps those REST API calls and makes them easier to reference via PowerShell (well, PowerShell in this case--API wrappers can be in any language). So no, the "easy button" is missing, but the functionality is there and you can build this yourself with a bit of effort.

@sridharallada
Copy link
Author

Hi Pedro,

Thanks a lot for suggestion.I tried to inspect the traffic from browser and thats exactly what you have mentioned.I can see the The endpoint as "/Reports/api/v2.0/PowerBIReports(Path={})/Model.Upload.Tried to update the code in below block (commented with #)but no luck.Is it possible to look in to this for you?

    if ($RestApiVersion -eq "v1.0")
    {
        $catalogItemsByPathApi = $ReportPortalUri + "api/$RestApiVersion/CatalogItemByPath(path=@path)?@path=%27{0}%27"
    }
    else
    {
        $catalogItemsByPathApi = $ReportPortalUri + "api/$RestApiVersion/CatalogItems(Path='{0}')"
        #$catalogItemsByPathApi = $ReportPortalUri + "api/$RestApiVersion/PowerBIReports(Path='{0}')/Model.Upload"
        Write-Output $catalogItemsByPathApi
    }
    $catalogItemsUpdateUri = $ReportPortalUri + "api/$RestApiVersion/CatalogItems({0})"
    #$catalogItemsUpdateUri = $ReportPortalUri + "api/$RestApiVersion/PowerBIReports(Path=%27{0}%27)/Model.Upload"

@okpedro
Copy link

okpedro commented Dec 8, 2020

Here's what a working script looks like, I published it via a gist.. I'd consider it a rough draft, but it's the best you're going to get for now! Perhaps if I get some additional time I can clean this up and contribute it to the project. It worked with a 200MB PBIX for me--I hope it works for you too.

@lorenzouriel
Copy link

Some updated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants