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

Should not truncate full url during cy.request() in stdout #3145

Open
cmcnicholas opened this Issue Jan 16, 2019 · 3 comments

Comments

3 participants
@cmcnicholas
Copy link

cmcnicholas commented Jan 16, 2019

Is this a Feature or Bug?

I believe this to be a bug with Cypress dashboard where truncation of the output makes debugging issues via the dashboard or CI very difficult for developers. It is useful for instance to see body and url parameters when using something like cy.request however the output on failure is formatted in a way which inhibits the ability to debug issues.

Current behavior:

the output in the cypress dashboard for a 404 (any sufficiently large output will do) looks like

 1) toolbar layer style "before all" hook for "should edit style name":
     CypressError: cy.request() failed on:

http://xyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxy/api/customer?token=uy9aG2yVRlyPAcW_xvTZEXlTvRm6O4u_

The response we received from your web server was:

  > 404: Not Found

This was considered a failure because the status code was not '2xx' or '3xx'.

If you do not want status codes to cause failures pass the option: 'failOnStatusCode: false'

-----------------------------------------------------------

The request we sent was:

Method: POST
URL: http://xyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxy/api/customer?token=uy9aG2yVRlyPAcW_xvTZEXlTvRm6...
Headers: {
  "user-agent": "E2E",
  "accept": "*/*",
  "accept-encoding": "gzip, deflate",
  "content-type": "application/json",
  "content-length": 74
}
Body: {"clusterId":"Dev-Alpha-Cluster","name":"Fin Fang Foom e2e20190116163428","OtherStuff":"ThisIsSomeDa...

see that the body and url are being truncated in this final block of the log. For small payloads it's fine, but when payloads become larger (or other cy methods that produce longer lines) the truncation makes the output almost useless. This is more of a problem when the errors are only produced on the CI server.

Desired behavior:

I would like some control over the output here, several options:

  • Download the raw output (unmodified)
  • Wrap long lines preserving the entire line
  • Have an option to open raw in the browser

Steps to reproduce: (app code and test code)

Simply perform a cy.request with a sufficiently large url or body e.g.

cy.request({
  method: 'POST',
  url: 'http://myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong.url',
})

Versions

Cypress: 3.1.3

I don't believe the browser to be an issue in this specific issue.

@jennifer-shehane

This comment has been minimized.

Copy link
Member

jennifer-shehane commented Jan 18, 2019

Hi @cmcnicholas, I want to be sure about where you are seeing this data. When you review this output, you are on the Cypress Dashboard webpage? So, visiting a url like: https://dashboard.cypress.io/#/projects/123abc/runs/678/specs yes?

@cmcnicholas

This comment has been minimized.

Copy link
Author

cmcnicholas commented Jan 18, 2019

Hi @cmcnicholas, I want to be sure about where you are seeing this data. When you review this output, you are on the Cypress Dashboard webpage? So, visiting a url like: https://dashboard.cypress.io/#/projects/123abc/runs/678/specs yes?

Yes that is correct @jennifer-shehane

@jennifer-shehane

This comment has been minimized.

Copy link
Member

jennifer-shehane commented Jan 18, 2019

Thanks for the reply. The truncating appears to be happening within the CLI, so the full url is never being fully printed in the output that is later printed in the Dashboard.

Doing cypress run locally prints:

  1)  Long request:
     CypressError: cy.request() failed trying to load:

http://myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong.url/

We attempted to make an http request to this URL but the request failed without a response.

We received this error at the network level:

  > Error: getaddrinfo ENOTFOUND myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong.url myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong.url:80

-----------------------------------------------------------

The request we sent was:

Method: POST
URL: http://myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreal...

-----------------------------------------------------------

Common situations why this would fail:
  - you don't have internet access
  - you forgot to run / boot your web server
  - your web server isn't accessible
  - you have weird network configuration settings on your computer

The stack trace for this error is:

RequestError: Error: getaddrinfo ENOTFOUND myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong.url myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong.url:80
    at new RequestError.............//more content printed here

The code for this url to print in the error message is

So, I would recommend removing this truncation, if we have to set a limit, it seems that the standard recommended cutoff for urls is 2000 characters.

@jennifer-shehane jennifer-shehane changed the title Cypress Dashboard Truncates Output Should not truncate full url during cy.request() in stdout Feb 11, 2019

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