-
Notifications
You must be signed in to change notification settings - Fork 24
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
main.dart.js -- Generated file improper usage of .toString #33
Comments
Is this error at runtime? What's the Dart code to cause this error (is it simply using the environment variable?) |
I had it happen yesterday with a different env variable too on a diff function. Yes, this is just assigning a string to the OpenAI api key (also a string). Maybe related to #29? |
Another case of weird casting --- final examples =
jsonDecode(body['examples']) as List<Map<String, dynamic>>; becomes examples = type$.List_Map_String_dynamic._as(B.C_JsonCodec.decode$2$reviver(A._asString(body.$index(0, "examples")), null)); with error
because of the _asString call. |
A possible workaround: use This will likely cause some issues, but at least the code will work until we have a solution. |
After generating my edge function, I received
I'm not sure if the code generation is directly handled by dart edge. As you can see, the root of this comes from a Deno.env variable. It may be more proper to always add these to a empty string. The issue is fixed after removing
t1.toString;
I think this happens because of the way this library maps the String value to the OpenAI type --
OpenAI.apiKey = edge.Deno.env.get('OPENAI_API_KEY')!;
the occurrence of this convention might be rare, but this issue will at minimum serve to help others know they can simply remove the .toString from generated code.
The text was updated successfully, but these errors were encountered: