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

Saving Webhook Event Template Fails with Alert Dialog [Object object] #152

Closed
jadenz98 opened this issue Mar 4, 2020 · 7 comments
Closed
Assignees
Labels

Comments

@jadenz98
Copy link

jadenz98 commented Mar 4, 2020

Expected Behavior

When creating a webhook event template, the event template should be saved upon clicking Save Template.

Current Behavior

An alert dialog appears with the text [Object object], the event template dialog remains, and the event template is not saved.

Steps to Reproduce (for bugs)

  1. Navigate to the Webhook Templates page under Administration and click Add New Template
  2. Enter any legal values for the input fields and click Create button
  3. In the new webhook template, select Add Build Event Template
  4. Select any values and click Save Template
  5. Alert dialog appears with text [Object object] and does not save build event template

Your Environment

  • tcWebHooks Version: 1.1.355.396
  • TeamCity Version: 1.1.355.396
  • TeamCity server Operating System: Linux
  • Are you using a WebHook Template?: Yes

Example Configuration (xml)

Will provide if needed

@netwolfuk
Copy link
Member

Hi @jadenz98 can you please take a look at the JavaScript console in your browser and see if there are any errors there?

Open the console and then click save.
There might be an error shown. There should be the object displayed. Can you have a look and see what the object contains?

@netwolfuk
Copy link
Member

Also, which browser are you using? Name and version please.

@jadenz98
Copy link
Author

jadenz98 commented Mar 4, 2020

Here is a screenshot of the error and object I see in the developer console on Google Chrome. If you need more detailed information please let me know.

Also, my browser is Google Chrome version 78.0.3904.97

Capture

@netwolfuk
Copy link
Member

Thanks. It looks like the URL to post the templates to is being calculated incorrectly. Is your TeamCity instead located somewhere other than / on your server?

Can you post the URL from your browser as shown when you're editing the template? You can remove the hostname. I'm just interested in the part after that. I suspect it's not just /webhooks/template.html.

@netwolfuk
Copy link
Member

netwolfuk commented Mar 5, 2020

Hi @jadenz98 I have reproduced this problem. It occurs when the webapps/ROOT directory is renamed to webapps/teamcity (in your case).

This changes what's called the "context" in Tomcat. However, the TeamCity REST API does not build the REST API URLs correctly (by adding the context to the start) when building the response, and my code just uses the href returned by teamcity to build the URL to POST to.

I have raised a bug with TeamCity here: https://youtrack.jetbrains.com/issue/TW-64841

I'll try to come up with a work around over the weekend. I have tried some things today, but have not been successful in generating the href references correctly.

@netwolfuk
Copy link
Member

The response from the TeamCity developers is that this is by design.

I will need to work around it by prefixing the context onto the URL when the rest request is executed.

I'll work on this over the weekend and do a new release to resolve this issue.

netwolfuk added a commit that referenced this issue Mar 6, 2020
If Teamcity is installed a location other than "/", (eg webapps/ROOT
renamed to webapps/teamcity) then requests made using the URL built
from the href field returned in the REST payload would fail.

This fix prepends the window['base_uri'] string, which contains the
Tomcat context prefix.

Fixes #152
@netwolfuk
Copy link
Member

@jadenz98 A new release is available, which fixes this bug.

Thanks for taking the time to report it.

@netwolfuk netwolfuk self-assigned this Mar 6, 2020
@netwolfuk netwolfuk added the bug label Mar 6, 2020
netwolfuk added a commit that referenced this issue Mar 6, 2020
If Teamcity is installed a location other than "/", (eg webapps/ROOT
renamed to webapps/teamcity) then requests made using the URL built
from the href field returned in the REST payload would fail.

This fix prepends the window['base_uri'] string, which contains the
Tomcat context prefix.

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

No branches or pull requests

2 participants