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

从5.1开始build之后出现 Uncaught TypeError: Cannot create property 'createCredentials' on string '0' #473

Closed
jiyarong opened this issue May 21, 2018 · 15 comments

Comments

@jiyarong
Copy link

jiyarong commented May 21, 2018

  • Browser Version or Node Version: chrome 最新, node 8.9.1
  • ali-oss Version: 5.2

在create-react-app中使用

var OSS = require('ali-oss/dist/aliyun-oss-sdk.min.js')
export const client = new OSS.Wrapper({
	region: 'oss-cn-beijing',
	accessKeyId: 'xxx',
	accessKeySecret: 'xxx',
	bucket: 'peter-blog'
});

build完之后,出现
Uncaught TypeError: Cannot create property 'createCredentials' on string '0'

@luozhang002
Copy link
Contributor

luozhang002 commented May 21, 2018

@jiyarong 请问你的build是指使用create-react-app脚手架工具构建后运行npm run build吗?
我本地使用create-react-app(1.5.2)脚手架创建了一个新的项目,用n把切换node 版本到8.9.1,chrome的版本如下
2018-05-22 6 59 42
然后项目下安装了ali-oss@5.2.0版本,在工程App.js引入你写的这段代码,再npm run build运行项目,本地并未发现报错。建议你尝试下:使用create-react-app重新构建一个新的项目,然后再安装我们的ali-oss,再引入这段代码,再build看是否有报错,或者把node_module删除再重新build一次,再看看有什么结果

@jiyarong
Copy link
Author

jiyarong commented May 22, 2018

@luozhang002 build不报错,部署后报错
你可以serve -s build运行一下试试

@mdluo
Copy link

mdluo commented Jun 26, 2018

最新的 ali-oss@5.3.0,通过 ali-oss/dist/aliyun-oss-sdk.min 导入,使用 webpack build 之后依然出现同样的报错,包括删除 node_module 重新安装之后。切换回 4.15.0 就没有这个问题了。

@luozhang002 问题还没有解决,请 reopen 这个 issue

@luozhang002 luozhang002 reopened this Jun 26, 2018
@linmowang
Copy link

linmowang commented Aug 22, 2018

Browser Version or Node Version: chrome 最新, node 8.9.3
ali-oss Version: 6.0.1
build不报错,部署后报错

部署后也报了: Cannot create property 'createCredentials' on string '0'
@luozhang002

@luozhang002
Copy link
Contributor

luozhang002 commented Sep 10, 2018

本地并未重现错误,本地采用了create-react-app脚手架,在APP.js代码里加入简单的OSS上传逻辑。我代码如下:
2018-09-10 11 11 20

server -s build

11_15_43__09_10_2018

浏览器运行后的结果
2018-09-10 11 11 04

我本地并未浮现。所以希望能提供具体的步骤和截图,我这边也方便统一修下。而且 ·Cannot create property 'createCredentials' on string '0' 这个错误感觉跟构建工具有关系吧
@jiyarong @mdluo @linmowang

@lzx493535562
Copy link

node v10.16
ali-oss v6.0.0
webpack v3.12.0
Browser路由模式
build后正常,部署到服务器访问时报错:
Uncaught TypeError: Cannot create property 'createCredentials' on string '0'
解决方案:删除node_modules; 使用yarn ;问题解决;
之前一直以为OSS版本问题,后面怀疑是使用cnpm&npm 吧(windows系统)!!!

@pan463859
Copy link

pan463859 commented Aug 12, 2019

"ali-oss": "^6.1.1",
导入方式
import OSS from 'ali-oss'

var client =new OSS({
region: 'xxxxxx',
accessKeyId:' xxxxxx',
accessKeySecret: 'xxxxxx',
bucket: 'xxxxxx'
});

function OSSDown (filename) {
let url = client.signatureUrl(filename);
return url
}
export {
OSSDown
}
本地运行没问题,打包上线报错 用的是yarn安装的 然后webpack打包

@web-Marker
Copy link

@jiyarong 请打开问题,目前也出现了这个问题,本地开发没有问题,放到线上就出问题

@0123cf
Copy link

0123cf commented Sep 25, 2019

同问题

@0123cf
Copy link

0123cf commented Sep 25, 2019

@luozhang002 是build后才出现 人家很明确指出了 然后你直接把issue关闭,不好吧。。

@PeterRao PeterRao reopened this Dec 23, 2019
@PeterRao
Copy link
Collaborator

PeterRao commented Dec 23, 2019

OSS.Wrapper 在5.x 以上版本已经废弃掉了。

@song3593
Copy link

我们现在也遇到同样问题。本地正常,线上部署后出错

@song3593
Copy link

reopen吧

@PeterRao PeterRao reopened this Jul 13, 2020
@PeterRao
Copy link
Collaborator

最好能给一个线上地址,我能调试下

weiyie added a commit that referenced this issue Jul 13, 2020
@PeterRao
Copy link
Collaborator

各位使用6.10.0 版本试下。之前因为压缩工具导致的问题

weiyie added a commit that referenced this issue Aug 3, 2020
PeterRao added a commit that referenced this issue Jan 11, 2021
* feat: add async task (#818)

* test: replace await loop with Promise.all (#810)

Co-authored-by: 饶培泽 <peizerao@gmail.com>

* feat: add typescript support (#814)

* feat: add ts

* feat: add cjs

* refactor: checkBucketName

* refactor: common/utils with ts

* refactor: createRequest with ts

* feat: add es2017

Co-authored-by: weiyie <912881342@qq.com>

* chore: add nyc config

* feat: asyncFetch (#817)

Co-authored-by: 冷若霜寒 <912881342@qq.com>

* chore: update tsc cli

* fix: WebFileReadStream no throw error when filereader onerror (#824)

* fix(browser): put unhandle non-RequestTimeTooSkewed error (#825)

* chore(deps-dev): bump standard-version from 4.4.0 to 8.0.1 (#831)

Bumps [standard-version](https://github.com/conventional-changelog/standard-version) from 4.4.0 to 8.0.1.
- [Release notes](https://github.com/conventional-changelog/standard-version/releases)
- [Changelog](https://github.com/conventional-changelog/standard-version/blob/master/CHANGELOG.md)
- [Commits](conventional-changelog/standard-version@v4.4.0...v8.0.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: crypto each exports, close #473 (#830)

Co-authored-by: 饶培泽 <peizerao@gmail.com>

* chore(release): 6.10.0

* chore: bump version

* chore: update README.md (#833)

Update description information of `getBucketVersions`

* fix: throw error when put path is not file (#838)

* fix: Support empty prefix in putBucketLifecycle (#835)

{prefix: ""} is supported for rule that applied to whole bucket.

* feat: multipartUpload support Node.JS Buffer (#832)

Support performing .multipartUpload(name {string}, file {Buffer});

Co-authored-by: 饶培泽 <peizerao@gmail.com>

* fix: IP does not support third-level domain (#834)

* refactor: is.buffer (#839)

* feat: putBucket support set acl and dataRedundancyType (#837)

* docs: add link for more info code (#844)

* feat: support non-english http header (#842)

* feat: support non-english http header

* test: Add test cases for non-English request header information

* feat: add headerEncoding option

* feat: add encoder types

* fix: remove object spread syntax

Co-authored-by: biejia <wb-bj559483@alibaba-inc.com>

* docs: add partSize of multipart (#845)

* fix: sts SignatureDoesNotMatch (#847)

* fix: _getPartSize (#846)

* chore: obj2xml support filter null and undefined value (#848)

* fix: multipartupload task unhandle abort error (#849)

* fix(browser): checkpoint.file (#795)

* fix: copyObject set headers bug (#850)

* feat: support proxy (#858)

* fix(browser): presets dont support ie10 (#861)

* merge branch master into develop

* feat: inventory (#860)

* feat: worm (#857)

* feat: auto set stsConfig when sts expires (#856)

* feat: auto set stsConfig when sts expires

* test: add auto set sts test case

* fix: host err which old image client request (#869)

* Develop (#868)

* feat: support non-english http header (#842)

* feat: support non-english http header

* test: Add test cases for non-English request header information

* feat: add headerEncoding option

* feat: add encoder types

* fix: remove object spread syntax

Co-authored-by: biejia <wb-bj559483@alibaba-inc.com>

* fix(browser): checkpoint.file (#795)

* merge branch master into develop

* feat: inventory (#860)

* feat: worm (#857)

* feat: auto set stsConfig when sts expires (#856)

* feat: auto set stsConfig when sts expires

* test: add auto set sts test case

* fix: host err which old image client request (#869)

Co-authored-by: beajer <919060679@qq.com>
Co-authored-by: biejia <wb-bj559483@alibaba-inc.com>
Co-authored-by: 冷若霜寒 <912881342@qq.com>

* chore(release): 6.11.0

* bump version 6.11.0

* chore: bump version 6.11.1

* fix(browser): delete set header "User-Agent" (#873)

* chore(release): 6.11.2

* chore: bump version 6.11.2

* Update README.md

* fix: use put insteadof putStream when calling multipartUpload to process small file in browser (#890)

* fix(browser):setTimeout  has minimum time interval when tab is inactive (#887)

* fix: replace process for browser

* fix: use browserify options to replace process.js (#886)

Co-authored-by: beajer <919060679@qq.com>

* fix: merge conflict #726 (#892)

* fix: merge conflict

* test: ResponseTimeoutError

* fix: cannot use ali-oss in webworker (#823)

* feat: retry when net err or timeout (#876)

* feat: retry when net err or timeout

* test: should not retry when params.stream is not readable

* test: retry in browser

Co-authored-by: beajer <919060679@qq.com>

* fix: getBucketVersions should use NextKeyMarker property (#896)

* fix: getBucketVersions should use NextKeyMarker property

* docs: getBucketVersions should use NextKeyMarker property

* docs: Compatible wrong property

* Fix multipart upload (#895)

* fix: multipartUpload

zancun

* fix: test case

* test: multipartUploadStreams

* test: cov

* fix: error method

* fix: test and destory(err) when cancel

Co-authored-by: weiyie <912881342@qq.com>

* feat: listObjectsV2 (#888)

* feat: listObjectsV2

* style: trailingComma none

* fix: check region and endpoint for ssrf (#874)

* fix: check region and endpoint for ssrf

* fix: retry in browser

Co-authored-by: beajer <919060679@qq.com>

* use shime/url replace node-url to fix split regex bug

* fix: browser test and listV2 docs (#901)

* chore(release): 6.12.0

* chore: build 6.12.0

* fix: conflict, test case

* style: remove duplicated code

* fix: the continuation-token params in listV2 (#906)

* fix: the continuation-token params in listV2

* docs: update headers.Expires

* docs: revise `start-after` in listV2 (#907)

* fix: codecov

* fix: should use encodeURIComponent insteadof encodeURI in copy api

* fix: use lowercase header when calculating signatures

* fix: deepCopy not working for larges Buffers and test case of Image Process

* feat: prevent caching for the get api

Co-authored-by: 饶培泽 <peizerao@gmail.com>
Co-authored-by: 冷若霜寒 <912881342@qq.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: YUPENG12138 <30425185+YUPENG12138@users.noreply.github.com>
Co-authored-by: Alois Klink <alois.klink@gmail.com>
Co-authored-by: biejia <wb-bj559483@alibaba-inc.com>
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

10 participants