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

yarn bundle: internal error: unsupported file type #187

Open
haf opened this issue Mar 11, 2022 · 5 comments
Open

yarn bundle: internal error: unsupported file type #187

haf opened this issue Mar 11, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@haf
Copy link

haf commented Mar 11, 2022

Describe the bug
With my repo, having linked another workspace (that is a package) into my workspace (that is the HTTP API service), running yarn bundle yields:

$ yarn bundle
➤ YB1000: ┌ Prepare /Users/h/repo/sdk-api for bundling
➤ YB1000: │ Preparing temporary directory
➤ YB1000: │ Copying repo to temporary directory
Internal Error: Unsupported file type
    at pQ (/Users/h/.node/corepack/yarn/3.2.0/yarn.js:314:7977)
    at async /Users/h/.node/corepack/yarn/3.2.0/yarn.js:314:8880
    at async Promise.all (index 2)
    at async wfe (/Users/h/.node/corepack/yarn/3.2.0/yarn.js:314:8846)
    at async pQ (/Users/h/.node/corepack/yarn/3.2.0/yarn.js:314:7808)
    at async /Users/h/.node/corepack/yarn/3.2.0/yarn.js:314:8880
    at async Promise.all (index 2)
    at async wfe (/Users/h/.node/corepack/yarn/3.2.0/yarn.js:314:8846)
    at async pQ (/Users/h/.node/corepack/yarn/3.2.0/yarn.js:314:7808)
    at async /Users/h/.node/corepack/yarn/3.2.0/yarn.js:314:8880

To Reproduce
No idea, since I don't know what file it chokes on.

Expected behavior
Internal errors should never be thrown to the user and if they do, should include context to debug.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. macOS, Linux, Windows/WSL]: macOS, node ^16, yarn v3
@haf haf added the bug Something isn't working label Mar 11, 2022
@ojkelly
Copy link
Owner

ojkelly commented Mar 12, 2022

Thanks for the detail on this report, that's certainly an odd one.

The last log line is from here https://github.com/ojkelly/yarn.build/blob/main/packages/plugins/plugin-bundle/src/commands/bundle/index.ts#L353

And all the work under that before the next log line uses the xfs package from yarn, which I believe is an abstraction over native file system operations.

Is it possible that there's a corrupt file, or something that could be tripping that up?

Are you able to put together a repository that reproduces this?


I do agree with your comment on expected behaviour, I do want to catch these errors and provide more actionable information about what to do.

@jkruse14
Copy link

I am experiencing this issue, too. I have a basic handler with this struture:
Screen Shot 2022-09-23 at 1 55 34 PM

yarn build works as expected, but when running yarn bundle I get the following:

% yarn bundle
➤ YB1000: ┌ Prepare /Users/j/workspace/lambdas/packages/hello for bundling
➤ YB1000: │ Preparing temporary directory
➤ YB1000: │ Copying repo to temporary directory
Internal Error: Unsupported file type (49645)
    at aQ (/Users/j/workspace/lambdas/.yarn/releases/yarn-3.2.3.cjs:309:7977)
    at async /Users/j/workspace/lambdas/.yarn/releases/yarn-3.2.3.cjs:309:8880
    at async Promise.all (index 0)
    at async wge (/Users/j/workspace/lambdas/.yarn/releases/yarn-3.2.3.cjs:309:8846)
    at async aQ (/Users/j/workspace/lambdas/.yarn/releases/yarn-3.2.3.cjs:309:7808)
    at async /Users/j/workspace/lambdas/.yarn/releases/yarn-3.2.3.cjs:309:8880
    at async Promise.all (index 0)
    at async wge (/Users/j/workspace/lambdas/.yarn/releases/yarn-3.2.3.cjs:309:8846)
    at async aQ (/Users/j/workspace/lambdas/.yarn/releases/yarn-3.2.3.cjs:309:7808)
    at async /Users/j/workspace/lambdas/.yarn/releases/yarn-3.2.3.cjs:309:8880

I've tried removing files like the README.md and any non .js files to experiment, but that made no difference.

@haf
Copy link
Author

haf commented Sep 26, 2022

No, it's likely not a corrupt file, because that would entail reading the file to see what's in it, which in turn would be a security vulnerability. Instead I believe files should either be of a known mime type, or have a file extension that's trusted by the calling code.

I don't know how I got this fixed actually, but it cost me a few hours until it magically started working.

@ojkelly
Copy link
Owner

ojkelly commented Sep 29, 2022

@jkruse14 would you be able to upload an example repo where this occurs?

@alexjball
Copy link

I am seeing this as a result of having sockets in my repo (git-secret), during the initial copy into a temp dir. The bundleignore seems to be applied after that copy, so I am not sure how to work around this using the built-in tool. Temporarily removing the sockets makes the bundle complete.

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

4 participants