alephjs / aleph.js

The Full-stack Framework in Deno.
https://aleph.deno.dev/
MIT License
5.27k stars 167 forks source link

Import map failing when running uninstalled using deno run ../start.ts #415

Open tiptenbrink opened 3 years ago

tiptenbrink commented 3 years ago

When running Aleph.js in a Docker container and using a bash file with the start command as entrypoint, it no longer seems to correctly use import maps. I wanted to use Aleph.js uninstalled on the standard deno docker image and used the following command to start the server:

deno run -A https://deno.land/x/aleph@v0.3.0-beta.19/commands/start.ts . --port 8080

The server starts fine, but the import map does not work.

Here is the error:

I access the API: root@f12a79749f84:/opt/sd# curl localhost:8080/api/status/a (See on GitHub, the GitHub also contains the full project that this was tested on)

<!DOCTYPE html>
<title>Server Error</title>
<h1>Error: Relative import path "base64url" not prefixed with / or ./ or ../ from "file:///opt/sd/api/status/[server].ts"</h1>
<p><pre>TypeError: Relative import path "base64url" not prefixed with / or ./ or ../ from "file:///opt/sd/api/status/[server].ts"
    at async Aleph.getAPIRoute (https://deno.land/x/aleph@v0.3.0-beta.19/server/aleph.ts:486:29)
    at async Server.handle (https://deno.land/x/aleph@v0.3.0-beta.19/server/server.ts:240:23)
    at async https://deno.land/x/aleph@v0.3.0-beta.19/server/server.ts:382:15</pre></p>

It works fine if I just normally spin it up on my Linux machine or if I manually install Aleph on the container and then use aleph start.

ije commented 3 years ago

if you run your app by bootstrapping the start.ts, you need to pass the --import-map manually, pls use cli.ts start that will handle the import map automatically

tiptenbrink commented 3 years ago

if you run your app by bootstrapping the start.ts, you need to pass the --import-map manually, pls use cli.ts start that will handle the import map automatically

Ah that makes sense. I just looked at the Deployment docs and assumed it would work the same. Maybe a good idea to add a caveat there that if using it like that you have to supply the import map manually?