Closed as not planned
Closed as not planned
Description
👟 Reproduction steps
This issue has been moved here from open-runtimes#194, as suggested by Steven on Discord.
Previously on 1.3x
the entry point file was allowed to be used in the root directory & it wasn't necessary that it should be inside lib
directory.
However, on 1.4x
function building fails.
Even the default path for the entry point is lib/main.dart
if Platform.environment['OPEN_RUNTIMES_ENTRYPOINT']
is null
.
If the entry point is in the root directory, the build fails with below error:
server.dart:5:8: Error: Error when reading 'lib/main.dart': No such file or directory
import 'package:packageName/main.dart' as user_code;
^
server.dart:107:25: Error: Method not found: 'main'.
user_code.main(context)
^^^^
server.dart:117:38: Error: Method not found: 'main'.
output = await user_code.main(context);
Build works fine if the main.dart
is inside the lib
folder.
The error stems from here, I believe:
serv = serv.replaceAll('{entrypoint}', "package:$packageName/" + fileName);
Proposed solution:
- Add relevant info to docs to follow the standard
Dart
file structure convention - Move the entry point inside the
lib
directory when building the function.
👍 Expected behavior
- Like previous versions, allow using the
entrypoint
as mentioned while deploying theFunction
. - Use the
Dart
's standard file structure convention and let the developer know about this via Docs. - Simply move the
entrypoint
file inside thelib
folder when preparing for the build.
👎 Actual Behavior
Function build process fails with below error:
Error: Method not found: 'main'.
user_code.main(context)
^^^^
server.dart:117:38: Error: Method not found: 'main'.
output = await user_code.main(context);
🎲 Appwrite version
Version 1.4.x
💻 Operating system
Linux
🧱 Your Environment
Nothing fancy, just the same old localhost
.
👀 Have you spent some time to check if this issue has been raised before?
- I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- I have read the Code of Conduct