8000 🐛 Bug Report: Dart Runtime expects the `entrypoint` file to be inside `lib` folder · Issue #6202 · appwrite/appwrite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
🐛 Bug Report: Dart Runtime expects the entrypoint file to be inside lib folder #6202
Closed as not planned
@ItzNotABug

Description

@ItzNotABug

👟 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:

  1. Add relevant info to docs to follow the standard Dart file structure convention
  2. Move the entry point inside the lib directory when building the function.

👍 Expected behavior

  1. Like previous versions, allow using the entrypoint as mentioned while deploying the Function.
  2. Use the Dart's standard file structure convention and let the developer know about this via Docs.
  3. Simply move the entrypoint file inside the lib 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingproduct / functionsFixes and upgrades for the Appwrite Functions.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0