Closed zirinisp closed 5 years ago
I am getting the same error using onWrite instead of onUpdate
Thanks for the report!
Looks like dart2js started doing more type checks since dev.52. I suspect you have checked flag in your build.yaml
? E.g.:
builders:
build_node_compilers|entrypoint:
generate_for:
- node/**
options:
compiler: dart2js
# List any dart2js specific args here, or omit it.
dart2js_args:
- --checked # <-- This
If you remove dart2js_args
block (last two lines) the error should go away. This would be a bit of a workaround (though in production you'd want to disable checked mode anyway).
Thank you for the reply. I changed my build.yaml file to the following:
targets:
$default:
sources:
- "node/**"
- "lib/**"
builders:
build_node_compilers|entrypoint:
generate_for:
- node/**
options:
compiler: dart2js
# List any dart2js specific args here, or omit it.
#dart2js_args:
#- --checked
I also tried the following (just in case it makes a difference:
targets:
$default:
sources:
- "node/**"
- "lib/**"
builders:
build_node_compilers|entrypoint:
generate_for:
- node/**
options:
compiler: dart2js
# List any dart2js specific args here, or omit it.
dart2js_args:
#- --checked
Unfortunately, I am getting the same error.
Bear in mind that I do not get an error for onCreate, which uses DocumentSnapshot snapshot
, instead of Change<DocumentSnapshot> change
.
Ok, thanks! I’ll do some more investigation today.
I just added a test case for Firestore onWrite
trigger and I must say that disabling --checked
mode in dart2js fixes the issue for me. Enabling it back gives the same stack trace as you provided.
Not sure why you still getting the error. Could you double check and redeploy with no dart2js_args
section in build.yaml
? Sorry for the trouble.
Also, I just submitted https://github.com/dart-lang/sdk/issues/33313 hoping to get some help from the Dart team.
Le ven. 1 juin 2018 à 20:32, Anatoly Pulyaevskiy notifications@github.com a écrit :
Also, I just submitted dart-lang/sdk#33313 https://github.com/dart-lang/sdk/issues/33313 hoping to get some help from the Dart team.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pulyaevskiy/firebase-functions-interop/issues/25#issuecomment-393971182, or mute the thread https://github.com/notifications/unsubscribe-auth/ABpC1kusHBv4CS1He-GAQFqs5DaPKKWkks5t4Yi-gaJpZM4UUzZX .
We got some help from the team. Looks like --checked
flag might go away with Dart 2. Given that I switched to --preview-dart-2
flag as was suggested in the SDK issue, and it worked. I did find a different strong mode issue, which was easy to fix, will publish an update later today.
@zirinisp let me know if redeploying without --checked
flag still doesn't work for you.
Update: 1.0.0-dev.6.0 is published, which includes strong mode fixes. Building with --preview-dart-2
should work now.
I updated dart to 2.0.0-dev.60.0
, commented out --checked
flag, run pub get
, run pub update
, run pub run build_runner build
and then uploaded to firestore firebase deploy --only functions
.
So I am now using your latest version 1.0.0-dev6.0.
I am getting the following for deploy so everything was uploaded:
i deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (38.98 MB) for uploading
✔ functions: functions folder uploaded successfully
i functions: updating function createDocument...
i functions: updating function updateDocument...
✔ functions[createDocument]: Successful update operation.
✔ functions[updateDocument]: Successful update operation.
✔ Deploy complete!
I go to my firestore database and update something. That triggers the function and I get the error.
So removing the --checked
flag did not help
Using --preview-dart-2
I could not find a way to use it. Please help me with the syntax. pub run build_runner build --preview-dart-2
did not work.
I read somewhere that this option is not enabled by default.
Updating build_runner and build_node_compilers
I then went on my pubspec and updated it to:
dev_dependencies:
# Needed to compile Dart to valid Node.js module.
build_runner: ^0.8.9. # was 0.7.9
build_node_compilers: ^0.1.3 # was 0.1.0
I am still getting the same error. So it is not related to the latest dependencies.
I could not find a way to use it.
Sorry I wasn't clear. You just need to replace --checked
with --preview-dart-2
in build.yaml
:
targets:
$default:
sources:
- "node/**"
- "lib/**"
builders:
build_node_compilers|entrypoint:
generate_for:
- node/**
options:
compiler: dart2js
dart2js_args:
- --preview-dart-2
I'm going to guess now but it seems like --checked
is still getting pickup up from somewhere.
build.yaml
files around?Hope we can get it solved soon!
Hello and thank you for your help. We should find a way to fix it at the end.
There is only one and it is the same as the one you send me on your last message.
I am running the following commands:
To build run:
pub run build_runner build
To deploy to firebase:
firebase deploy --only functions
I have it on a private repo. If it helps, I could also share it with you.
@pulyaevskiy any news on the issue?
Sorry for delay here. I tried copy-pasting your function and running on test account and it seems to be working fine with no errors.
So, I'm not able to reproduce the error at this point.
I'm almost out of option at this point. One last thing I can ask if you can share output of pub run build_runner build
command?
@zirinisp I'm closing this issue for now but feel free to leave a comment or reopen if it's still unresolved.
Running the following code when on document update generates an error
I get the following error.
Could be related to https://github.com/pulyaevskiy/firebase-functions-interop/issues/23
My versions are:
And my pubspec.yaml is: