Skip to content

Conversation

kevireilly
Copy link

@kevireilly kevireilly commented Jan 1, 2023

Brief Summary of Changes

  • Using Node version 16.16.0 and likely lower major Node versions, there is an os module breaking change where os.tmpDir() is now os.tmpdir() when running on macOS 10.15.1.
  • This appears to be resolved and/or handled by a more recent version of the connect-multiparty module.
  • Upgrading it reveals a small incompatibility where req.files.image.ws.bytesWritten is no longer available, so, a potential guess solution has been applied by using req.files.image.size instead.
  • Error observed when uploading a photo via the Add photo button on the photo-album sample:
TypeError: os.tmpDir is not a function
    at new Form (/Users/kevinreilly/Development/cloudinary_npm/samples/photo_album/node_modules/multiparty/index.js:55:44)
    at multipart (/Users/kevinreilly/Development/cloudinary_npm/samples/photo_album/node_modules/connect-multiparty/index.js:56:16)
    at Layer.handle [as handle_request] (/Users/kevinreilly/Development/cloudinary_npm/samples/photo_album/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/kevinreilly/Development/cloudinary_npm/samples/photo_album/node_modules/express/lib/router/route.js:144:13)
    at Route.dispatch (/Users/kevinreilly/Development/cloudinary_npm/samples/photo_album/node_modules/express/lib/router/route.js:114:3)
    at Layer.handle [as handle_request] (/Users/kevinreilly/Development/cloudinary_npm/samples/photo_album/node_modules/express/lib/router/layer.js:95:5)
    at /Users/kevinreilly/Development/cloudinary_npm/samples/photo_album/node_modules/express/lib/router/index.js:284:15
    at Function.process_params (/Users/kevinreilly/Development/cloudinary_npm/samples/photo_album/node_modules/express/lib/router/index.js:346:12)
    at next (/Users/kevinreilly/Development/cloudinary_npm/samples/photo_album/node_modules/express/lib/router/index.js:280:10)
    at /Users/kevinreilly/Development/cloudinary_npm/samples/photo_album/server.js:53:7

What Does This PR Address?

  • GitHub issue (Add reference - #XX)
  • Refactoring
  • New feature
  • Bug fix
  • Adds more tests

Are Tests Included?

  • Yes
  • No

Reviewer, Please Note:

Decision to replace req.files.image.ws.bytesWritten with req.files.image.size may not be correct as the former no longer appears to be available with an upgraded version of connect-multiparty, though I'm not certain this meets the original expectations of evaluating the bytesWritten.

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

Successfully merging this pull request may close these issues.

1 participant