Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish throws missing file errors #288

Closed
geelen opened this issue Jan 24, 2022 · 5 comments · Fixed by #292
Closed

Publish throws missing file errors #288

geelen opened this issue Jan 24, 2022 · 5 comments · Fixed by #292
Assignees

Comments

@geelen
Copy link
Contributor

geelen commented Jan 24, 2022

Running with a super simple module worker in TS:

// src/worker.ts
const onRequest: ExportedHandlerFetchHandler = async (request, env, ctx) => {
  return new Response('Hi.')
}

export default {
  fetch: onRequest,
}

Note: p is my alias for pnpm

❯ p wrangler publish src/worker.ts
ENOENT: no such file or directory, open '/var/folders/3f/fwp6mt7n13bfnkd5vl3jmh1w0000gp/T/tmp-61545-4Y5kwyNI8DGU/src/worker.ts'

Trying to jump into src and do it there:

❯ cd src
❯ p wrangler publish worker.ts
✘ [ERROR] Could not resolve "/Users/glen/src/projects/holodb/examples/1-simple/worker.ts"

Build failed with 1 error:
error: Could not resolve "/Users/glen/src/projects/holodb/examples/1-simple/worker.ts"

I'm in a PNPM repo with workspaces, so maybe that's doing something 🕺 FUNKY 🕺

❯ cat node_modules/.bin/wrangler
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

if [ -z "$NODE_PATH" ]; then
  export NODE_PATH="/Users/glen/src/projects/holodb/node_modules/.pnpm/wrangler@0.0.11/node_modules/wrangler/bin/node_modules:/Users/glen/src/projects/holodb/node_modules/.pnpm/wrangler@0.0.11/node_modules/wrangler/node_modules:/Users/glen/src/projects/holodb/node_modules/.pnpm/wrangler@0.0.11/node_modules:/Users/glen/src/projects/holodb/node_modules/.pnpm/node_modules:/Users/glen/src/projects/holodb/node_modules:/Users/glen/src/projects/node_modules:/Users/glen/src/node_modules:/Users/glen/node_modules:/Users/node_modules:/node_modules:/Users/glen/src/projects/holodb/examples/1-simple/node_modules:/Users/glen/src/projects/holodb/examples/node_modules"
else
  export NODE_PATH="$NODE_PATH:/Users/glen/src/projects/holodb/node_modules/.pnpm/wrangler@0.0.11/node_modules/wrangler/bin/node_modules:/Users/glen/src/projects/holodb/node_modules/.pnpm/wrangler@0.0.11/node_modules/wrangler/node_modules:/Users/glen/src/projects/holodb/node_modules/.pnpm/wrangler@0.0.11/node_modules:/Users/glen/src/projects/holodb/node_modules/.pnpm/node_modules:/Users/glen/src/projects/holodb/node_modules:/Users/glen/src/projects/node_modules:/Users/glen/src/node_modules:/Users/glen/node_modules:/Users/node_modules:/node_modules:/Users/glen/src/projects/holodb/examples/1-simple/node_modules:/Users/glen/src/projects/holodb/examples/node_modules"
fi
if [ -x "$basedir/node" ]; then
  exec "$basedir/node"  "$basedir/../../../../node_modules/.pnpm/wrangler@0.0.11/node_modules/wrangler/bin/wrangler.js" "$@"
else
  exec node  "$basedir/../../../../node_modules/.pnpm/wrangler@0.0.11/node_modules/wrangler/bin/wrangler.js" "$@"
fi
@Electroid Electroid added the bug label Jan 24, 2022
@petebacondarwin
Copy link
Contributor

The script is resolved relative to the current working directory. Perhas pnpm is running the wrangler binary from somewhere else?

As a workaround can you check that providing an absolute path to the script works?

@geelen
Copy link
Contributor Author

geelen commented Jan 24, 2022

Same error I'm afraid:

❯ p wrangler publish /Users/glen/src/experiments/simple-pnpm-worker/src/worker.ts
ENOENT: no such file or directory, open '/var/folders/3f/fwp6mt7n13bfnkd5vl3jmh1w0000gp/T/tmp-63290-YJ44eXf3zfOM/src/worker.ts'

Sunil has a repro, I think he said it's a smallish fix...

@threepointone threepointone self-assigned this Jan 24, 2022
@threepointone
Copy link
Contributor

I figured it out. Fix incoming

@petebacondarwin
Copy link
Contributor

Tenterhooks...

@threepointone
Copy link
Contributor

It'll take longer than a few minutes :) Working on a comprehensive fix, a bit tricky...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants