-
Notifications
You must be signed in to change notification settings - Fork 603
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
AWS SDK 3 TypeError: 0, util_user_agent_browser_1.createDefaultUserAgentProvider is not a function #6573
Comments
Hi @JulianHillworth - thanks for reaching out. Could you please confirm the issue with the latest release |
I've had the same error, I've upgraded the react native version from 0.67.5 to 0.75.3 and the issue started appearing when trying to boot a Client using new CloudWatchLogsClient... To reproduce, start a new react native app and create a dummy file that only calls the client, is enough to trigger the error on newer react native versions... In my case, the error message is the following:
|
Thanks for chiming in. Could you please verify with the latest SDK release, which is version |
Hello @aBurmeseDev, the issue seems to be incompatibility with the react native above 0.74... I've done the following and was able to reproduce:
Then I've added the following to App.tsx
after that I've run yarn install and yarn ios |
Can you add the following polyfills and give it another try? import "react-native-get-random-values";
import "react-native-url-polyfill/auto";
import "web-streams-polyfill/dist/polyfill"; It's mentioned in our README that react-native environment requires certain polyfills to work with SDK:
|
There is an important note: this issue seems to happen to all versions above 3.398.0 of the aws-sdk-js-v3. The @aws-sdk/client-cloudwatch-logs was working with react native 0.67.5, but since the upgrade to the latest react-native version the issue started... I've tried to rollback to react-native 0.67.5 and it started working again, however, we can't use that react-native version as Android requires a patch that's only available on versions above 0.72(that has the issue already) |
Appreciate the additional details. A few more questions to verify before further investigation:
|
We only using Cloudwatch logs, but I believe this happens in all clients when used by react native 0.7x
I don't think the issue is directly related with the SDK version but an incompatibility with the newer versions of react-native, the 3.398.0 works on react-native 0.67.5 but not in 0.7x such as 0.75.3 My understanding is that the react native is not bundling properly the aws-sdk, almost as this package is being recognised as a dev package (even when defined in the dependencies) |
Hi, just tried it on cognito-identity-provider v3.670 again. v3.674 is still unavailable on NPM for cognito-identity-provider. Same issue. Revert it back to 3.654 works. Confirmed I have the polyfills installed. The other one i had issue with was SNS, that responded with the same error, latest version is still only v3.670 Code snippet
TypeError: 0, util_user_agent_browser_1.createDefaultUserAgentProvider is not a function (it is undefined), js engine: hermes |
Thank you for providing comprehensive details; it assisted me in my testing process. After evaluating multiple versions, I have identified that |
Hello @aBurmeseDev, thanks for the help. I've confirmed that version 3.669.0 does not trigger the error, we will remain on that version temporarily while you and your team fix the issue on a new version containing all the patches between 3.669.0 and 3.674. |
@aBurmeseDev , this issue is happening on @aws-sdk/client-scheduler 3.674.0 as well. I tried downgrading the library to lower versions such as v3.670.0 , v3.665.0, but it's still not working. When I investigated the package-lock.json file, it was still downloading the v3.674.0 zip from npm even for the lower versions and even after deleting the package lock and node modules. |
@catarinadasilva - thank you for your troubleshooting. |
Hi @catarinadasilva! Quick update; the fix was released in However, if anyone's still see the issue after upgrading to version Thanks again for reporting this! |
Not sure if this is related but I have the same issue while updating
The executing code is like this: const s3 = new S3Client(this.appConfig.aws.client);
const signedUrlExpireSeconds = 60 * 60;
const command = new PutObjectCommand({
Bucket: this.appConfig.aws.s3bucket,
Key: `images/${newId()}`,
ContentType: contentType
});
const url = await getSignedUrl(s3, command, {expiresIn: signedUrlExpireSeconds});
return {url}; |
UPDATE: @aBurmeseDev, the issue I've reported in this comment was due to another aspect of our setup and not related with the cloudwatch lib... everything works with the latest |
@catarinadasilva - appreciate the update and glad the issue is now resolved. @sqrter - remove the node_modules directory and/or the package-lock file, and then reinstall the required packages. There might be lingering issues between dependencies and package versions. |
@aBurmeseDev Though reinstalling didn't help, I found where the problem was - in transitive dependencies. I had a resolution configuration for one of my dependencies, and one of its transitive dependencies was also used in |
Seems like this issue is still happening with node.js Lambda . Everything is freshly installed in my environment. version: 3.679.0
|
I have the same problem, tried with new versions like 3.674.0, 3.675.0, 3.679.0 but it does not work. I am using: in NextJS project deployed as standalone service on ubuntu server. Node version is v18.17.0. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Checkboxes for prior research
Describe the bug
React Native Project
utilising
@aws-sdk/client-cognito-identity-provider": "^3.654.0",
@aws-sdk/client-dynamodb": "^3.654.0",
@aws-sdk/client-s3": "^3.654.0",
@aws-sdk/client-sns": "^3.654.0",
@aws-sdk/client-sqs": "^3.654.0",
@aws-sdk/credential-provider-cognito-identity": "^3.654.0",
amazon-cognito-identity-js": "^6.3.12
Patched to
@aws-sdk/client-cognito-identity-provider 3.670.0
@aws-sdk/client-dynamodb 3.670.0
@aws-sdk/client-s3 3.673.0
@aws-sdk/client-sns 3.670.0
@aws-sdk/client-sqs 3.670.0
@aws-sdk/credential-provider-cognito-identity 3.670.0
npx expo run:android builds correctly. No issues on previous versions.
After applying updates and running npx expo run:android it also builds correctly once again.
When running the project receive error
TypeError: 0, util_user_agent_browser_1.createDefaultUserAgentProvider is not a function
This occurs on @aws-sdk/client-cognito-identity-provider and @aws-sdk/client-sns from what I can tell.
Uninstall modules reinstall previous versions. works correctly. Nothing else has changed in the project. Merely updating the AWS modules.
Regression Issue
SDK version number
AWS-SDK-JS-V3
Which JavaScript Runtime is this issue in?
React Native
Details of the browser/Node.js/ReactNative version
0.74.5
Reproduction Steps
To reproduce, run a build with the new patched dependencies compared to the previous.
Observed Behavior
AWS services @aws-sdk/client-cognito-identity-provider and @aws-sdk/client-sns will not work in the project.
Expected Behavior
To continue operation as per version updated from.
Possible Solution
What was changed, change back.
Additional Information/Context
Nil
The text was updated successfully, but these errors were encountered: