Closed dgaedcke closed 3 years ago
Just try with the current version.
brew install node
FYI: #3120
I can confirm this is a problem with m1 macs. You can't deploy firebase functions with any version of node. The firebase cli does not work for functions on m1 macs.
I also received a message from firebase support indicating it is not a priority for them to fix, so good luck.
I don't have immediate access to an M1. I'm going to try to get my hands on one and look into it.
I'm not able to replicate this on a Mac Mini M1 running node v12.20 or v15.8, and firebase-tools v9.4.0. (and brew v2.7.3). I updated node using the n
cli.
I tried installing via npm install firebase-tools -g
and also via curl -sL firebase.tools | upgrade=true bash
, and both work for me.
firebase --version
and firebase deploy
on the code from https://github.com/firebase/quickstart-js/tree/master/functions both are succeeding.
yes, the Firebase CLI won't run on M1 macs, but you can get around this problem by doing the following:
add this code near the top of your function:
process.env.GCLOUD_PROJECT = "pbusterapi" const admin = require('firebase-admin'); admin.initializeApp();
and then use gcloud to deploy as follows:
gcloud functions deploy newCommFeedRecord \ --trigger-event providers/google.firebase.database/eventTypes/ref.create \ --trigger-resource projects/_/instances/pbusterapi/refs/commNews/{date}/{window}/{record} \ --runtime nodejs12 --project pbusterapi
it will attempt an init by guessing the creds directly from the project name that seems to be working for us right now
I'm not able to replicate this on a Mac Mini M1 running node v12.20 or v15.8, and firebase-tools v9.4.0. (and brew v2.7.3)
I tried installing via
npm install firebase-tools -g
and also viacurl -sL firebase.tools | upgrade=true bash
, and both work for me.
firebase --version
andfirebase deploy
on the code from https://github.com/firebase/quickstart-js/tree/master/functions both are succeeding.
The only problem is deploying functions. Try deploying 3 or 4 functions using this command: firebase deploy --only functions
Let me know what happens using node 15.8
I haven't tried using node 12. I've been using node 14 & 15.
No issues using node 15 and firebase deploy --only functions
node -v
: v15.8.0
@dgaedcke I've been using my windows machine to deploy my functions. I don't want to code around the cli issue.
The best option is to fix what is wrong with the cli running on apple silicon. The dev kit for apple silicon has been out since last summer. If I were a firebase project lead I would have assigned qa testing for the cli on apple silicon months ago. Firebase is a product sold by google, so I would want to know my product worked correctly on something as major as apple silicon.
No issues using node 15 and
firebase deploy --only functions
node -v
: v15.8.0
Very interesting. You are the first to report that. Firebase support sent me a message indicating they knew it was a documented issue. It might be helpful if they knew what was different in your setup.
Do you have the gcloud tools installed?
Not currently. I'll try that next.
Could it have to do with homebrew? I changed node versions with the n
tool, not brew.
I don't think so. I'm using nvm which built nodejs from src for version 14 & 15 since the binaries were not present for darwin/arm64. Im using npm 6 instead of 7 since 7 has had some issues.
Fortunately I have a windows machine I can use since I build windows desktop apps for some of my clients.
Have you tried on the latest firebase-tools version?
I think I've narrowed this down to node being installed via nvm (built locally, rather than downloading binaries).
When installing node via n
(downloads binary):
sudo n 15.8
: installed : v15.8.0
which node
: /usr/local/bin/node
Deploy completeWhen installing node via nvm
(builds binary locally):
nvm install 15.8
nvm use 15
: Now using node v15.8.0 (npm v7.5.1)
which node
: /Users/kiana/.nvm/versions/node/v15.8.0/bin/nodeDeployment error. Build failed: Build error details not available.
Interesting. Where did you get your darwin/arm64 node binaries from?
Have the same issue. nvm@0.37.2 node@14.15.4 firebase-tools@9.4.0
Will it help to switch to n or volta?
I don't know. There are multiple issues related to m1.
It's just a rough road right now. Kiana says she has not had the same problems but everyone I have talked to has. I'm wondering if she installed node while using the terminal running under rosetta. I tried that and the intel binaries for node get installed that way, but you don't get the benefit of arm64 while using node.
I don't know. There are multiple issues related to m1.
- I have not been able to find node binaries for darwin/arm64 so I use nvm to build them
- NPM v7 has documented issues. Angular 11 does not currently work with npm 7
- Firebase cli crashes with node 14
- Firebase deploy of functions fails with node 15
It's just a rough road right now. Kiana says she has not had the same problems but everyone I have talked to has. I'm wondering if she installed node while using the terminal running under rosetta. I tried that and the intel binaries for node get installed that way, but you don't get the benefit of arm64 while using node.
Just tried Volta with node 14 LTS. It uses Rosetta 2 under the hood to run node. And it solves the issue with the Firebase cli. Just deployed my functions 🙃
That makes sense. If I didn't have my windows machine to deploy my functions I would probably have to run node under rosetta too. It would be nice if Firebase would just fix the issue in the cli of running on darwin/arm64. Every other thing I do with node running on arm64 works fine.
Ah, that's an excellent insight @donhmorris. The n
version does indeed run the x64 binaries, and nvm
runs arm64.
@donhmorris Thanks for your patience here. IIUC -
Did I get this right? If so, can you share the error you are seeing when trying to deploy functions using node 15? Preferably on https://github.com/firebase/firebase-tools/issues/3120.
@taeold yes, that is correct. Node 15+ built by nvm using source.
Added the cloud build logs to #3120
I'm using node 12 on mac m1 and have the same trouble.
firebase-tools@9.6.1
[16492:0x150008000] 546 ms: Scavenge 34.5 (52.7) -> 25.0 (54.9) MB, 2.8 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
[16492:0x150008000] 1004 ms: Scavenge 40.1 (58.1) -> 32.0 (62.6) MB, 3.1 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x00010d0808d1 <JSObject>
0: builtin exit frame: new constructor(aka Module)(this=0x00010e6d69f9 <Object map = 0x1149ee749>,0x00010e6d68a9 <Uint8Array map = 0x10d042b99>,0x00010e6d69f9 <Object map = 0x1149ee749>)
1: ConstructFrame [pc: 0x10130efb8]
2: StubFrame [pc: 0x1013f7a64]
3: /* anonymous */ [0x10e6d6149] [/opt/homebrew/lib/node_modules/firebase-tools/node_modules/long/src/long.js:9] [bytecode=0x11...
FATAL ERROR: wasm code commit Allocation failed - process out of memory
1: 0x100cada60 node::Abort() [/opt/homebrew/opt/node@12/bin/node]
2: 0x100cadbe0 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string<std::nullptr_t>(char const*) [/opt/homebrew/opt/node@12/bin/node]
3: 0x100db3748 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/opt/homebrew/opt/node@12/bin/node]
4: 0x100db36dc v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/opt/homebrew/opt/node@12/bin/node]
5: 0x1011e427c v8::internal::wasm::WasmCodeAllocator::AllocateForCodeInRegion(v8::internal::wasm::NativeModule*, unsigned long, v8::base::AddressRegion) [/opt/homebrew/opt/node@12/bin/node]
6: 0x1011e4ef8 v8::internal::wasm::NativeModule::CreateEmptyJumpTableInRegion(unsigned int, v8::base::AddressRegion) [/opt/homebrew/opt/node@12/bin/node]
7: 0x1011e44c0 v8::internal::wasm::NativeModule::AddCodeSpace(v8::base::AddressRegion) [/opt/homebrew/opt/node@12/bin/node]
8: 0x1011e4d40 v8::internal::wasm::NativeModule::NativeModule(v8::internal::wasm::WasmEngine*, v8::internal::wasm::WasmFeatures const&, bool, v8::internal::VirtualMemory, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>, std::__1::shared_ptr<v8::internal::Counters>, std::__1::shared_ptr<v8::internal::wasm::NativeModule>*) [/opt/homebrew/opt/node@12/bin/node]
9: 0x1011e6c40 v8::internal::wasm::WasmCodeManager::NewNativeModule(v8::internal::wasm::WasmEngine*, v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, unsigned long, bool, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/opt/homebrew/opt/node@12/bin/node]
10: 0x1011ecf98 v8::internal::wasm::WasmEngine::NewNativeModule(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, unsigned long, bool, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/opt/homebrew/opt/node@12/bin/node]
11: 0x1011ecee0 v8::internal::wasm::WasmEngine::NewNativeModule(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/opt/homebrew/opt/node@12/bin/node]
12: 0x1011ca95c v8::internal::wasm::CompileToNativeModule(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, v8::internal::wasm::ErrorThrower*, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>, v8::internal::wasm::ModuleWireBytes const&, v8::internal::Handle<v8::internal::FixedArray>*) [/opt/homebrew/opt/node@12/bin/node]
13: 0x1011ea9fc v8::internal::wasm::WasmEngine::SyncCompile(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, v8::internal::wasm::ErrorThrower*, v8::internal::wasm::ModuleWireBytes const&) [/opt/homebrew/opt/node@12/bin/node]
14: 0x1012039f8 v8::(anonymous namespace)::WebAssemblyModule(v8::FunctionCallbackInfo<v8::Value> const&) [/opt/homebrew/opt/node@12/bin/node]
15: 0x100e0217c v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/opt/homebrew/opt/node@12/bin/node]
16: 0x100e015a4 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/opt/homebrew/opt/node@12/bin/node]
17: 0x100e010bc v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/opt/homebrew/opt/node@12/bin/node]
18: 0x10139192c Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/opt/homebrew/opt/node@12/bin/node]
19: 0x10130efb8 Builtins_JSBuiltinsConstructStub [/opt/homebrew/opt/node@12/bin/node]
20: 0x1013f7a64 Builtins_ConstructHandler [/opt/homebrew/opt/node@12/bin/node]
21: 0x101313d80 Builtins_InterpreterEntryTrampoline [/opt/homebrew/opt/node@12/bin/node]
22: 0x101313d80 Builtins_InterpreterEntryTrampoline [/opt/homebrew/opt/node@12/bin/node]
23: 0x101313d80 Builtins_InterpreterEntryTrampoline [/opt/homebrew/opt/node@12/bin/node]
24: 0x104ff6510
25: 0x10500b3b0
...
[1] 16492 abort firebase
Is there any solution without install node 15v or using volta?
Any updates on this?
For the pre-node 15 questions, it does seem to be a problem with node itself, and it's generally fixed by running on the x86 / rosetta version - check out https://github.com/nvm-sh/nvm/blob/master/README.md#troubleshooting-on-macos
For the error where most of the CLI works, but functions deploys don't (due to the uploaded archive not being able to be uncompressed), check out #3120 for updates.
Same issue here. Any update?
I haven't had any issues after installing node 16, which contains a binary version for arm64
me 2
same for me, any updates on this?
For the pre-node 15 questions, it does seem to be a problem with node itself, and it's generally fixed by running on the x86 / rosetta version - check out https://github.com/nvm-sh/nvm/blob/master/README.md#troubleshooting-on-macos
For the error where most of the CLI works, but functions deploys don't (due to the uploaded archive not being able to be uncompressed), check out #3120 for updates.
TL;DR - Please check your node version and upgrade to >15.3.0 (relevant stackoverflow).
For the pre-node 15 questions, it does seem to be a problem with node itself, and it's generally fixed by running on the x86 / rosetta version - check out https://github.com/nvm-sh/nvm/blob/master/README.md#troubleshooting-on-macos For the error where most of the CLI works, but functions deploys don't (due to the uploaded archive not being able to be uncompressed), check out #3120 for updates.
TL;DR - Please check your node version and upgrade to >15.3.0 (relevant stackoverflow).
Works with node 15. Thank you @taeold
[REQUIRED] Environment info
I've reinstalled Firebase with: curl -sL firebase.tools | upgrade=true bash and firebase --version yields: Abort trap: 6 (partial log below)
Running M1 Mac 11.2 Node12 installed with Homebrew ARM64
~$ brew --version Homebrew 3.0.0 Homebrew/homebrew-core (git revision 7eaf2; last commit 2021-02-09) Homebrew/homebrew-cask (git revision c2081; last commit 2021-02-10)
[REQUIRED] Test case
Try it yourself on an M1 mac
[REQUIRED] Steps to reproduce
Try it yourself on an M1 mac
[REQUIRED] Expected behavior
Installs and runs
[REQUIRED] Actual behavior