Closed kostaa closed 5 years ago
Could you also provide following?
dart --version
)node --version
)firebase --version
)package.json
pubspec.yaml
This would help in investigating your issue.
The minified index.dart.js
is not much of a help here, unfortunately.
Dart VM version: 2.0.0 (Fri Aug 3 10:53:23 2018 +0200) on "windows_x64" Node version: v8.12.0 Firebase version: 5.1.1
package.json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"dependencies": {
"firebase-admin": "^6.0.0",
"firebase-functions": "^2.0.5"
},
"private": true,
"main": "build/node/index.dart.js"
}
pubspec.yaml
name: mv_cloud_functions
version: 1.0.0
environment:
sdk: '>=2.0.0 <3.0.0'
dependencies:
firebase_functions_interop: ^1.0.0-dev
system_payee_rules:
path: ../lib_sys_payee_rules
dev_dependencies:
build_node_compilers: any
build_runner: any
test: any
These are the actual versions
firebase_functions_interop: "1.0.0-dev.10.0" build_node_compilers: "0.2.0" build_runner: "1.0.0"
Hi @pulyaevskiy, have you had time to have a look into this?
Hey, it's a bit hard to reproduce this error on my end giving available information.
I suspect that there is some code in lib_sys_payee_rules
which causes this issue. If there is any way you can compose a reduced test case, this would help significantly.
The lib_sys_payee_rules
library has dependencies on some other libraries (eg quiver
) and I am currently writing another cloud function that will need dart:convert
library and maybe some others.
In your examples you seem to use only the underlying Firestore javascript libraries. I am trying to be careful when bringing in additional dependencies but it would be good to know the limitations - what is allowed and what is not.
In general, with JS interop you can't use dart:io
or any package which depends on dart:io
because this library is only available in the Dart VM. That's the main limitation.
For this reason I've also created node_interop
and node_io packages. Nice thing about node_io
is that it wraps Node.js I/O using the same interfaces you normally use in dart:io
, so you get Futures and Streams for free. Note though that I've only implemented a portion of dart:io
interfaces (most FS classes, HttpServer), so if you end up needing a method which throws UnimplementedError
feel free to submit an issue here: https://github.com/pulyaevskiy/node-interop/issues.
If you need to make an HTTP request I'd also recommend node_http which implements HttpClient interface from http package.
Other built-in libraries like dart:convert
can be used without any issues.
Great that is good news. I will try and narrow it down to the piece of code that is causing the issue.
Managed to find the issue. One of the libraries that I was bringing in contains a class that imports the dart:io
library. All works as expected once I removed this class from the library.
However this class is not used by any of the classes reachable from the cloud functions I am deploying. Since is not reachable I would expect that it is not included in the compiled JavaScript code.
Great you resolved this!
Since is not reachable I would expect that it is not included in the compiled JavaScript code.
I would expect the same. Is it an open source library from Pub? Would be nice to understand why it causes issues.
No these are all my libraries. I will try an reproduce this in a small project.
Ok, no worries. I'll close this for now, but feel free to send updates if you find something interesting.
Just to let you know that I have not managed to reproduce this. Looks like I had my wires crossed somewhere in the original implementation.
Good to know, thanks for getting back on this.
Getting this error during the deployment. Not sure if this is a Firebase issue or the generated code is invalid. When I googled this found somewhat similar problems that were resolved by downgrading the Firebase tools versions.
These are two functions that I am deploying. However when I remove the 'applySystemPayeeRules' method and the dependency on the the library where this is implemented all is good. So this makes me think that maybe the generated code is not quite right.
Here is the 'index.dart.js' if that helps. index.dart.js.zip