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

[Bug] ERR_INVALID_ARG_TYPE when uploading a file with the new cypress v7.0.0 #289

Open
andrei10k opened this issue Apr 7, 2021 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@andrei10k
Copy link

andrei10k commented Apr 7, 2021

Current behavior:

with the new cypress v7.0.0 and cypress-file-upload v5.0.4 the pdf upload is not working. i got the following error:

TypeError [ERR_INVALID_ARG_TYPE] [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer or Uint8Array. Received type number (45)
    at write_ (_http_outgoing.js:696:11)
    at ClientRequest.write (_http_outgoing.js:661:15)
    at Request.write (/Users/xxx/Library/Caches/Cypress/7.0.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/request/request.js:1496:27)
    at /Users/xxx/Library/Caches/Cypress/7.0.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/request/request.js:546:20
    at Array.forEach (<anonymous>:null:null)
    at end (/Users/xxx/Library/Caches/Cypress/7.0.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/request/request.js:545:23)
    at Immediate._onImmediate (/Users/xxx/Library/Caches/Cypress/7.0.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/request/request.js:578:7)
    at processImmediate (internal/timers.js:461:21)
 {
  code: 'ERR_INVALID_ARG_TYPE'
}
TypeError [ERR_INVALID_ARG_TYPE] [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer or Uint8Array. Received type number (45)
    at write_ (_http_outgoing.js:696:11)
    at ClientRequest.write (_http_outgoing.js:661:15)
    at Request.write (/Users/xxx/Library/Caches/Cypress/7.0.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/request/request.js:1496:27)
    at /Users/xxx/Library/Caches/Cypress/7.0.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/request/request.js:546:20
    at Array.forEach (<anonymous>:null:null)
    at end (/Users/xxx/Library/Caches/Cypress/7.0.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/request/request.js:545:23)
    at Immediate._onImmediate (/Users/xxx/Library/Caches/Cypress/7.0.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/request/request.js:578:7)
    at processImmediate (internal/timers.js:461:21)

✨  Done in 811.82s.

Desired behavior:

the upload should work as with version 6.8.0

Steps to reproduce: (app code and test code)

const yourFixturePath = 'template.pdf'
    cy.get('[data-cy="upload_btn"]').attachFile({
      filePath: yourFixturePath,
      mimeType: 'application/pdf',
      encoding: 'binary'
    })

Versions

cypress v7.0.0, cypress-file-upload v5.0.4, macos bug sur, chrome

@abramenal
Copy link
Owner

Hi @andrei10k
Thanks for submitting the issue!
Consider this as top priority issue, working on it

@slinkardbrandon
Copy link

Thanks for looking into this @abramenal, is there anything we can do to help? I just started running into this as well. I'm happy to investigate it a bit but I don't want to step on your toes. If I can help at all I would love to though.

@abramenal
Copy link
Owner

I couldn't reproduce the issue locally. Here is what I've used:

cypress@7.0.0 and @7.0.1
Electron@89
Chrome@89

It would be really nice if someone can set up a small repo with reproducible example. cc @slinkardbrandon

@daggmano
Copy link

Sounds like it may be a Cypress issue? See cypress-io/cypress#15901

@tagliala
Copy link

cypress-io/cypress#15901 should have been fixed in 7.2.0

btw, I'm successfully using 7.2.0 w 5.0.6 version of this gem and file uploads works on Chrome

@donalmurtagh
Copy link

donalmurtagh commented Apr 27, 2021

I've tested with 7.2.0 and the issue still exists. See this comment for further details.
It looks like this issue may be caused by this unresolved Cypress bug cypress-io/cypress#15898

@jozso39
Copy link

jozso39 commented Apr 28, 2021

This problem still exists for me as well on cypress 7.2.0
The crash doesnt occur on the file upload step, but only when trying to cy.intercept the request that uploads the file.

It worked in cypress 6.8.0 :(
So its probably a Cypress problem

@cuadllop
Copy link

cuadllop commented Apr 29, 2021

Still happening to me as well in 7.2.0

The last version where we have checked to be working is 6.9.1

@strass
Copy link

strass commented May 5, 2021

the fix in 7.3.0 pre-release here worked for me: cypress-io/cypress#15898 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants