Skip to content

expo环境下报错:TypeError: Cannot read property 'initWithSecurityToken' of null #16

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

Open
Qyokizzzz opened this issue Dec 10, 2023 · 0 comments

Comments

@Qyokizzzz
Copy link

我的代码:

const configuration = {
maxRetryCount: 3,
timeoutIntervalForRequest: 30,
timeoutIntervalForResource: 24 * 60 * 60,
};

export async function upload(bucketpath: string, uri: string) {
const filename = uri.split('/').pop();
const res = await getOssOpts();
const ossOpts = res.data.queryResult;
const { AccessKeyId, AccessKeySecret, SecurityToken } = ossOpts;
AliyunOSS.initWithSecurityToken(
SecurityToken,
AccessKeyId,
AccessKeySecret,
'oss-cn-beijing',
configuration,
);
const response = await AliyunOSS.asyncUpload(
appConfig.bucketName as string,
${bucketpath}/${filename},
uri,
);
}
环境:
win10
"react": "18.2.0",
"react-native": "0.72.6",
"rn-alioss": "^0.2.5",
"expo": "^49.0.21",
错误信息:
WARN Possible Unhandled Promise Rejection (id: 0):
TypeError: Cannot read property 'initWithSecurityToken' of null
TypeError: Cannot read property 'initWithSecurityToken' of null
at initWithSecurityToken (http://192.168.101.27:8081/index.bundle//&platform=android&dev=true&hot=false&lazy=true:187949:35)
at ?anon_0_ (http://192.168.101.27:8081/index.bundle//&platform=android&dev=true&hot=false&lazy=true:187837:82)
at next (native)
at asyncGeneratorStep (http://192.168.101.27:8081/index.bundle//&platform=android&dev=true&hot=false&lazy=true:28413:26)
at _next (http://192.168.101.27:8081/index.bundle//&platform=android&dev=true&hot=false&lazy=true:28432:29)
at tryCallOne (/Users/kudo/01_Work/Repos/expo/expo/android/versioned-react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/MinSizeRel/3n472i6k/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:53:16)
at anonymous (/Users/kudo/01_Work/Repos/expo/expo/android/versioned-react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/MinSizeRel/3n472i6k/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:139:27)
at apply (native)
at anonymous (http://192.168.101.27:8081/index.bundle//&platform=android&dev=true&hot=false&lazy=true:35046:26)
at _callTimer (http://192.168.101.27:8081/index.bundle//&platform=android&dev=true&hot=false&lazy=true:34925:17)
at _callReactNativeMicrotasksPass (http://192.168.101.27:8081/index.bundle//&platform=android&dev=true&hot=false&lazy=true:34970:17)
at callReactNativeMicrotasks (http://192.168.101.27:8081/index.bundle//&platform=android&dev=true&hot=false&lazy=true:35176:44)
at __callReactNativeMicrotasks (http://192.168.101.27:8081/index.bundle//&platform=android&dev=true&hot=false&lazy=true:6077:46)
at anonymous (http://192.168.101.27:8081/index.bundle//&platform=android&dev=true&hot=false&lazy=true:5851:45)
at __guard (http://192.168.101.27:8081/index.bundle//&platform=android&dev=true&hot=false&lazy=true:6050:15)
at flushedQueue (http://192.168.101.27:8081/index.bundle//&platform=android&dev=true&hot=false&lazy=true:5850:21)
at callFunctionReturnFlushedQueue (http://192.168.101.27:8081/index.bundle//&platform=android&dev=true&hot=false&lazy=true:5835:33)

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

No branches or pull requests

1 participant