Skip to content

The deployment failed: Relative import path, but import path was specified in deno.json imports section #324

@m0rphed

Description

@m0rphed

Hi!

I am having troubles deploying Hono project (deployctl 1.12.0):

❯ deployctl deploy --env-file=./.env --project=currency-exchange-rates 
i Using config file 'C:\Users\morph\proj\pet-react-hono-currency\display-currency-widget\server\deno.json'                                                                                                                                            
√ Deploying to project currency-exchange-rates.
√ Entrypoint: C:\Users\morph\proj\pet-react-hono-currency\display-currency-widget\server\main.ts                                                                                                                                                      
i Uploading all files from the current dir (C:\Users\morph\proj\pet-react-hono-currency\display-currency-widget\server)                                                                                                                               
√ Found 5 assets.
√ Uploaded 1 new asset.
× Deployment failed.
error: The deployment failed: Relative import path "hono/cors" not prefixed with / or ./ or ../

maybe Deno Deploy does not fully read "imports" section inside my deno.json (?):

{
  "imports": {
    "hono": "jsr:@hono/hono@^4.5.2",
    "@std/dotenv/load": "jsr:@std/dotenv/load"
  },
  "tasks": {
    "start": "deno run --allow-net --allow-read --allow-env main.ts"
  },
  "compilerOptions": {
    "jsx": "precompile",
    "jsxImportSource": "hono/jsx"
  },
  "deploy": {
    "exclude": [".env"],
    "include": ["./jsons", "*.ts"],
    "entrypoint": "./main.ts"
  }
}

main.ts:

import { Hono } from "hono";
import { serveStatic } from "hono/deno";
import { cache } from "hono/cache";
import { cors } from "hono/cors";
import "@std/dotenv/load"
import { parseKnownCurrencies } from "./processData.ts";
import { CurrencyApiResponse } from "./types.ts";
...

I am getting:

× Deployment failed.
error: The deployment failed: Relative import path "@std/dotenv/load" not prefixed with / or ./ or ../

Which is strange for me - because locally with deno task start it all runs just fine on Deno version: 🦕 v1.45.4+8bab761

  • then is tried this:
import { Hono } from "hono";
import { serveStatic } from "hono/deno";
import { cache } from "hono/cache";
import { cors } from "hono/cors";
- import "@std/dotenv/load"
+ import "jsr:@std/dotenv/load"
import { parseKnownCurrencies } from "./processData.ts";
import { CurrencyApiResponse } from "./types.ts";
  • and now I am getting:
error: The deployment failed: Relative import path "hono/cors" not prefixed with / or ./ or ../

but hono is definitely in my imports

looks similar to #139

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions