workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

🐛 BUG: Cannot Wrangler Dev with D1 (NuxtJS)

Open jjjrmy opened this issue 2 years ago • 4 comments

What version of Wrangler are you using?

wrangler@d1 0.0.0-7c228171

What operating system are you using?

Mac

Describe the Bug

As soon as I add the d1_database to my wrangler.toml I get the error No matching export in ".output/server/index.mjs" for import "default" when running npx wrangler@d1 dev

Error:

Retrieving cached values for account from node_modules/.cache/wrangler
✘ [ERROR] No matching export in ".output/server/index.mjs" for import "default"

../../../../private/var/folders/zv/hw6r8q9j365df9rl1ncgm2f80000gn/T/tmp-56345-ANj5xEsp2QnO/d1-beta-facade.entry.js:5:7:
5 │ import worker from "/Users/jjjrmy/Sites/***/.output/server/index.mjs";

wrangler.toml

d1_databases = [
  { binding="DB", database_name="***", database_id="***", preview_database_id="***" },
]

as soon as I take that out of my config file, it works

jjjrmy avatar Aug 28 '22 05:08 jjjrmy

can you share the full wrangler.toml (w/o secrets) and the source code of your worker script?

celso avatar Aug 31 '22 10:08 celso

@celso

name = "funnel"
workers_dev = true
compatibility_date = "2022-06-28"

main = ".output/server/index.mjs"

kv_namespaces = [
  { binding="BRANDS", id="***", preview_id="***" }
]

d1_databases = [
  { binding="DB", database_name="***", database_id="***", preview_database_id="***" },
]

[site]
bucket = ".output/public"

jjjrmy avatar Sep 01 '22 14:09 jjjrmy

@JacobMGEvans how can I make a reproduction without exposing my secrets?

jjjrmy avatar Sep 03 '22 14:09 jjjrmy

@JacobMGEvans how can I make a reproduction without exposing my secrets?

Fake secrets.

JacobMGEvans avatar Sep 05 '22 15:09 JacobMGEvans

You must define an "export default" function

zeger-pon avatar Nov 03 '22 13:11 zeger-pon

@jjjrmy I'm going to close this issue, feel free to reopen if you're still experiencing this problem!

caass avatar Jan 05 '23 16:01 caass