-
Notifications
You must be signed in to change notification settings - Fork 58
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
Unable to resolve "@vercel/blob/client" #505
Comments
hey @tryzeno, I just tested |
Steps:
Just writing upload in there causes the error, you don't need to setup a whole api route or anything. Let me know if you are unable to replicate. |
I successfully executed |
closing this since no update since 2 months. If the issue still exists feel free to reopen |
@correttojs it doesn't work with ios though |
I found if you add: "resolver": {
"unstable_enablePackageExports": true
} to your metro config, the bundler can correctly resolve the This leads to a different error for me though where If you also run into this issue it might be worth opening an issue in |
I too am getting this error in my react-native project (Expo CNG) |
@sajeeIfonix Can you bring this issue over to the expo repository? Our package.json is correct as per https://arethetypeswrong.github.io/?p=%40vercel%2Fblob%400.22.3 so I suspect something is wrong with expo/expo setup here. It would be awesome to find out what 🙏 |
Thanks for looking into this. I guess we'll use AWS S3 until this issue is resolved. |
Hey, Edit: The linked issue describes excactly the problem I have while the initial issue seems to differ. So I'm not sure if this are different causes. For completness my error log:
|
I am facing this issue as well in my react-native project: |
|
Are there any known workarounds for this issue? |
Still just using S3 instead of Vercel Blob because of this bug. |
Please be aware that That said we can help the Metro Bundler find the correct files by adding this Code to our You can check out a fully working repo here https://github.com/luismeyer/blob-expo-app/tree/main // Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require("expo/metro-config");
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);
config.resolver.resolveRequest = (context, moduleName, platform) => {
const isBlob = context.originModulePath.includes("@vercel/blob");
if (isBlob && moduleName === "stream") {
const lookup = context.fileSystemLookup(
"./node_modules/@vercel/blob/dist/stream-browser.js"
);
return {
type: "sourceFile",
filePath: lookup.realPath,
};
}
if (isBlob && moduleName === "undici") {
const lookup = context.fileSystemLookup(
"./node_modules/@vercel/blob/dist/undici-browser.js"
);
return {
type: "sourceFile",
filePath: lookup.realPath,
};
}
if (isBlob && moduleName === "crypto") {
const lookup = context.fileSystemLookup(
"./node_modules/@vercel/blob/dist/crypto-browser.js"
);
return {
type: "sourceFile",
filePath: lookup.realPath,
};
}
return context.resolveRequest(context, moduleName, platform);
};
config.resolver.unstable_enablePackageExports = true;
module.exports = config; |
@luismeyer I tried your suggestion but I am seeing the attached error |
@maestrodrew that might be the expo/metro version you are using. I am using the latest version for the working example. That said you don't necessarily need the if (isBlob && moduleName === "stream") {
return {
type: "sourceFile",
filePath: "./node_modules/@vercel/blob/dist/stream-browser.js",
};
}
if (isBlob && moduleName === "undici") {
return {
type: "sourceFile",
filePath: "./node_modules/@vercel/blob/dist/undici-browser.js",
};
}
if (isBlob && moduleName === "crypto") {
return {
type: "sourceFile",
filePath: "./node_modules/@vercel/blob/dist/crypto-browser.js",
};
} |
@luismeyer Thanks for the help! I was able to successfully upload a file from my react native app to Vercel Blob. |
Using React Native with Expo and ran
yarn add @vercel/blob
. When I try to do:I get:
Version:
The text was updated successfully, but these errors were encountered: