美文网首页
firebase网络问题解决方案

firebase网络问题解决方案

作者: kelvv | 来源:发表于2018-04-30 23:47 被阅读90次

    share my solution for who work inside and wanna live outside the GFW.

    Env: MacOS with shadowsocks-ng

    ~/.bash_profile

    alias cbrew="ALL_PROXY=socks5://127.0.0.1:1086 brew"
    
    # using polipo
    alias cfirebase="http_proxy=http://127.0.0.1:8123 firebase"
    
    # your shadowsocks may already have http proxy feature
    alias cfirebase="http_proxy=http://127.0.0.1:1087 firebase"
    

    up polipo http proxy (optional)

    cbrew install polipo
    polipo socksParentProxy=localhost:1086 &
    

    login

    cfirebase login --debug
    

    polyfill faye-websocket

    Thanks @namiwang it works.

    because firebase sdk 2.x.x is minified, so... polyfill faye-websocket is easier than fix sdk.

    // if you installed node by brew, the path would be /usr/local/lib/node_modules/firebase-tools/node_modules/firebase/node_modules/faye-websocket/lib/faye/websocket/client.js
    ...
    var proxy_uri = process.env.http_proxy
    if (proxy_uri) {
      options.proxy = { origin: proxy_uri }
    }
    ...
    

    deploy

    cfirebase deploy --only functions --debug
    

    Actually, newer firebase sdk already fixed the bug. Waiting firebase-tools up deps to date...

    相关文章

      网友评论

          本文标题:firebase网络问题解决方案

          本文链接:https://www.haomeiwen.com/subject/vgntrftx.html