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

Can't upload assets #396

Closed
fmq opened this issue Jul 2, 2020 · 7 comments
Closed

Can't upload assets #396

fmq opened this issue Jul 2, 2020 · 7 comments
Assignees
Labels
status: blocked 🚧 Resolution is blocked by some other issue or external factor type: bug 🐛 Something isn't working
Milestone

Comments

@fmq
Copy link

fmq commented Jul 2, 2020

Describe the bug
I created a default instance and when I try to upload assets it does not work, it gives the following error:

run:server] error 7/1/20, 8:55 PM - [ExceptionsHandler] Maximum call stack size exceeded
[run:server] RangeError: Maximum call stack size exceeded
[run:server]     at _openReadFs (internal/fs/streams.js:150:21)
[run:server]     at ReadStream.<anonymous> (internal/fs/streams.js:146:3)
[run:server]     at ReadStream.deprecated [as open] (internal/util.js:89:15)
[run:server]     at ReadStream.open (/Users/fmq/workspace/work/my-app/node_modules/fs-capacitor/lib/index.js:90:11)
[run:server]     at _openReadFs (internal/fs/streams.js:153:12)
[run:server]     at ReadStream.<anonymous> (internal/fs/streams.js:146:3)
[run:server]     at ReadStream.deprecated [as open] (internal/util.js:89:15)
[run:server]     at ReadStream.open (/Users/fmq/workspace/work/my-app/node_modules/fs-capacitor/lib/index.js:90:11)
[run:server]     at _openReadFs (internal/fs/streams.js:153:12)
[run:server]     at ReadStream.<anonymous> (internal/fs/streams.js:146:3) 

To Reproduce
Steps to reproduce the behavior:

  1. execute with default values and any DB (I tested in MySql and sQlLite):
yarn create @vendure my-app
  1. execute:
cd my-app
yarn start
  1. Navigate to
http://localhost:3000/admin/catalog/assets
  1. Click on "Upload Asset" and select an image.

If debug is enabled the following is printed:

image

Expected behavior
The asset is uploaded to the asset library.

Environment (please complete the following information):

  • @vendure/core version: 0.13.1
  • Nodejs version: v14.4.0
  • Database (mysql/postgres etc): Mysql / SqlLite

Additional context
after testing I added debug by adding logger config to config file (src/vendure-config.ts)

logger: new DefaultLogger({ level: LogLevel.Debug }),
@fmq fmq added the type: bug 🐛 Something isn't working label Jul 2, 2020
@michaelbromley
Copy link
Member

I think this is due to the graphql-upload version used by apollo-server-express. See this issue: apollographql/apollo-server#4039

The gist of it is that the current version of apollo server (which Vendure uses) uses an outdated version of the graphql-upload library, which is incompatible with node v13+. This PR looks to be approved so as soon as it makes it into a version of Apollo server then we can update our dependency.

@michaelbromley michaelbromley added the status: blocked 🚧 Resolution is blocked by some other issue or external factor label Jul 2, 2020
@fmq
Copy link
Author

fmq commented Jul 2, 2020

Excelent, so my other path if I did not want to wait (or they take too long ) would be to revert node to 12.x ..

Thanks, I'll try this, do you want to leave this open so we validate once the PR is applied or would you prefer to put it on hold?

@fmq
Copy link
Author

fmq commented Jul 2, 2020

I just downgraded to node v12.18.2 and it's working now.

I will retest once de PR is in place and re-open this issue if it still fails.

Thanks

@rohanrajpal
Copy link
Contributor

I think this is due to the graphql-upload version used by apollo-server-express. See this issue: apollographql/apollo-server#4039

The gist of it is that the current version of apollo server (which Vendure uses) uses an outdated version of the graphql-upload library, which is incompatible with node v13+. This PR looks to be approved so as soon as it makes it into a version of Apollo server then we can update our dependency.

I guess they are altogether removing inbuilt graphql-upload support
apollographql/apollo-server#3508 (comment)

Although some person is claiming a library upgrade is fixing their issue
apollographql/apollo-server#4039 (comment)

@michaelbromley
Copy link
Member

Re-opening this because it looks like Apollo will not fix this until Server v3, and we don't want people to keep running into this when we launch Vendure v1.0.

@michaelbromley michaelbromley reopened this Feb 5, 2021
@michaelbromley michaelbromley added this to the v1.0.0 milestone Feb 5, 2021
@michaelbromley
Copy link
Member

Looks like the Apollo team have decided to get this solved in v2: apollographql/apollo-server#4865

Hopefully then we'll just need to upgrade to the latest Apollo Server v2.x to resolve this.

@michaelbromley
Copy link
Member

The fix is now available in apollo-server-core v2.21.0, but unfortunately we can't directly ugrade to that right now because we it is a transitive dependency via @nestjs/graph, which is still using v2.16.1. Therefore the fix for now will probably be to implement something like nestjs/graphql#901 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: blocked 🚧 Resolution is blocked by some other issue or external factor type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants