Repository navigation
Issue publishing one workbook but not others #1139
Copy link
Copy link
Closed
Labels
bughelp wantedA user needs help, may be a mistake, a bug or a feature requestA user needs help, may be a mistake, a bug or a feature request
Description
I'm trying to publish a set of workbooks via the Tableau Server Client. All of the workbooks that I'm publishing are working perfectly as expected except for one. The workbook that is not publishing correctly is connected to three separate published data sources. The other workbooks that are publishing correctly are connected to a variety of published and live data sources.
Versions
- Tableau Online
- Python 3.7
To Reproduce
upload_dF = pd.read_excel(fullpath + 'Tableau Input.xlsx', sheet_name='Upload')
for row in upload_dF.itertuples():
server_name = row.server
project_id = row.project_id
name = row.name
workbook_path = row.filepath
config = tableau_config[server_name]
tableau_auth = TSC.PersonalAccessTokenAuth(
config['personal_access_token_name'],
config['personal_access_token_secret'],
site_id=config['site_name'])
server = TSC.Server(config['server'], use_server_version=True)
with server.auth.sign_in(tableau_auth):
print(server_name + '-' + name)
connection_credentials = TSC.ConnectionCredentials(
conn_username,
conn_password,
embed=True,
oauth=True)
WorkbookItem = TSC.WorkbookItem(
name=name,
project_id=project_id,
show_tabs=True
)
try:
new_workbook = server.workbooks.publish(
WorkbookItem,
workbook_path,
mode='Overwrite',
# connections=dest_connections,
connection_credentials=connection_credentials,
skip_connection_check=True,
as_job=False
)
print('Published Destination Connections')
except:
new_workbook = server.workbooks.publish(
WorkbookItem,
workbook_path,
mode='Overwrite',
connections=None,
skip_connection_check=True,
as_job=False
)
print('Published without Destination Connections')
print("Successfully published {0} ({1})".format(new_workbook.name, new_workbook.id))
Results
tableauserverclient.server.endpoint.exceptions.ServerResponseError:
500000: Forbidden
User does not have permission for action.(The server encountered an error and cannot complete your request. Contact your server administrator.)
I am the site administrator and I have full admin access to all properties on the site.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bughelp wantedA user needs help, may be a mistake, a bug or a feature requestA user needs help, may be a mistake, a bug or a feature request
Activity
jacalata commentedon Nov 2, 2022
That is an unusual error code. Just to check: have you been able to publish this workbook manually? Have you tried publishing a workbook with connections to each of the datasources individually?
cmbramwell commentedon Nov 2, 2022
@jacalata Yes, I can publish the workbook manually.
As of an hour ago, I tried using the script to publish the workbook with different combinations of the data sources. I found one data source in the workbook that was causing the issue. I created a local copy of that data source. I then published the workbook with the two published data sources and one extract of the local copy. It worked.
I then tried creating a live version of the local copy, and it would not publish.
Any idea what may be causing this to throw an error for this one published data sources?
jacalata commentedon Nov 3, 2022
Hm, it's hitting a problem when it tries to verify the embedded credentials to the published datasource. Is it possible this datasource is not OAuth and your other datasources are? Or is there anything else that is different about this one?
It sounds like it might be related to this gap in the API: "Note: Even if credentials are embedded in a workbook, you must still provide credentials when connecting to a data source that requires credentials, unless that data source uses OAuth."
https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#publish_workbook
rkg5142 commentedon Nov 10, 2022
Hello, same issue for me - also a server admin with full permissions to everything.
Some workbooks can publish fine, while others return:
500000: Forbidden User does not have permission for action.(The server encountered an error and cannot complete your request. Contact your server administrator.)The strange thing is, the data source and creds are identical between failing and successfully published workbooks.
rkg5142 commentedon Nov 10, 2022
If this is helpful, for your investigation, in my instance, I am using TSC to download a workbook, the document API to modify datasource connection info, and re-publishing the workbook using TSC. The change I made to my code which introduces this error was updating
datasources.caption. If I remove this line, I can publish all workbooks fine - so likely is an issue with the value I was using for the field (AKA maybe a user error on my end).nosnilmot commentedon Jan 5, 2023
I'm seeing similar problems.
I can only successfully publish a workbook if I specify
connections=Noneandskip_connection_check=Falsein theserver.workbooks.publish()parameters.If I specify
connections=Noneandskip_connection_check=TrueI get the500000error reported here.If I specify
connectionsI see a variety of different errors (400011,403132,Internal error 500) for different combinations values ofconnectionsandskip_connection_checkI might be able to proceed with
connections=Noneandskip_connection_check=Falsebut that feels wrong.It is also very confusing that the errors occur more when connection check is disabled.
I'm using Tableau Server 2022.3 and can provide logs from server-side for failing API requests if it would be helpful.
nosnilmot commentedon Jan 11, 2023
I have solved (some of?) my problems, maybe these can help others too:
If an empty list is provided to
connections, Tableau Server reports500000error, solution is to passconnections=NoneinsteadIf passing a list of
ConnectionInfoitems inconnections, they must haveConnectionCredenialsset inconnection_credentialsattribute.Without this,
Internal error 500is reported. It is not sufficient to setusername/password/embed_passwordattributes of theConnectionInfoclass.This was not at all obvious because the documentation at https://tableau.github.io/server-client-python/docs/api-ref#connections does not even indicate there is a
connection_credentialsattribute ofConnectionInfo!Sometimes it just helps to use the correct username and password
Add connection-credentials element to connection
Do not create empty connections list
Do not create empty connections list (#1178)
[docs] Add connection-credentials element to connection (#1177)
jacalata commentedon Feb 15, 2023
@cmbramwell I think I ended up addressing the new issues people brought up, but not yours. Did anything here help, or did you figure it out yourself?
bryceglarsen commentedon May 8, 2024
We recently encountered this issue on Server Version 2023.3. We had no issues until this server upgrade and our original use of
skip_connections_check=Truenow results in generic400011: Bad Request.I can open a new issue, but waiting for logs from admin to verify further.
Removing the skip connections check allows us to publish successfully.