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

Vite fails to build when using AWS Amplify client-only code #9715

Closed
7 tasks done
ffxsam opened this issue Aug 17, 2022 · 1 comment
Closed
7 tasks done

Vite fails to build when using AWS Amplify client-only code #9715

ffxsam opened this issue Aug 17, 2022 · 1 comment

Comments

@ffxsam
Copy link

ffxsam commented Aug 17, 2022

Describe the bug

I'm using AWS Amplify (specifically their GraphQL client) in my Nuxt project (which uses Vite under the hood). I expect the project to build without issues, but instead, I get a build error.

Reproduction

https://github.com/ffxsam/repro-vite-aws-sdk

System Info

System:
    OS: macOS 12.5
    CPU: (8) arm64 Apple M1
    Memory: 187.50 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.15.0 - ~/Library/Caches/fnm_multishells/63945_1660754481872/bin/node
    Yarn: 3.2.2 - ~/Library/Caches/fnm_multishells/63945_1660754481872/bin/yarn
    npm: 8.11.0 - ~/Library/Caches/fnm_multishells/63945_1660754481872/bin/npm
  Browsers:
    Chrome: 104.0.5112.79
    Firefox: 102.0.1
    Safari: 15.6

Used Package Manager

yarn

Logs

 ERROR  'request' is not exported by __vite-browser-external, imported by node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/credential-provider-imds/dist/es/remoteProvider/httpRequest.js
file: /Users/samh/Code/repro-vite-aws-sdk/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/credential-provider-imds/dist/es/remoteProvider/httpRequest.js:4:9
2: import { ProviderError } from "@aws-sdk/property-provider";
3: import { Buffer } from "buffer";
4: import { request } from "http";
            ^
5: /**
6:  * @internal

Validations

@sapphi-red
Copy link
Member

It seems some code in aws-amplify depends on @aws-sdk/credential-provider-node which uses Node.js specific code.
The dependency graph is too complicated to investigate on our side. (https://npm.anvaka.com/#/view/2d/aws-amplify)

Closing for now as it's not actionable but feel free to create a new issue if it turns out to be a bug in Vite.

@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Aug 20, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants