denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97k stars 5.36k forks source link

Support Tanstack Start (tanstack.com) #24061

Open birkskyum opened 4 months ago

birkskyum commented 4 months ago

Version: Deno 1.44.0

Repro:

Clone https://github.com/tanstack/tanstack.com pnpm i (using pnpm v 8.10.2) DENO_FUTURE=1 deno task dev

Error:

➜ DENO_FUTURE=1 deno task dev
Task dev vinxi dev
vinxi v0.3.11
vinxi starting dev server

 ERROR  Cannot read properties of undefined (reading 'env')                                                                                                                                      2:23:41 PM

  at Object.plugins (app.config.timestamp_1717158220687.js:14:32)
  at Object.plugins (node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs:3193:40)
  at Object.plugins (node_modules/.pnpm/@tanstack+start@1.34.2_@opentelemetry+api@1.8.0_react-dom@18.3.1_react@18.3.1_typescript@5.3.3_vite@5.1.4/node_modules/@tanstack/start/dist/esm/config/index.js:152:59)
  at Object.plugins (node_modules/.pnpm/@tanstack+start@1.34.2_@opentelemetry+api@1.8.0_react-dom@18.3.1_react@18.3.1_typescript@5.3.3_vite@5.1.4/node_modules/@tanstack/start/dist/esm/config/index.js:211:45)
  at createViteHandler (node_modules/.pnpm/vinxi@0.3.11_@opentelemetry+api@1.8.0/node_modules/vinxi/lib/dev-server.js:58:31)
  at async Object.handler (node_modules/.pnpm/vinxi@0.3.11_@opentelemetry+api@1.8.0/node_modules/vinxi/lib/router-modes.js:147:27)
  at async Promise.all (index 1)
  at async createDevServer (node_modules/.pnpm/vinxi@0.3.11_@opentelemetry+api@1.8.0/node_modules/vinxi/lib/dev-server.js:155:5)
  at async Object.run (node_modules/.pnpm/vinxi@0.3.11_@opentelemetry+api@1.8.0/node_modules/vinxi/bin/cli.mjs:182:17)
  at async runCommand (node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs:316:16) 

 ERROR  Cannot read properties of undefined (reading 'env')    

Seems like it's breaking at:

authToken: process.env.SENTRY_AUTH_TOKEN,

But it works fine with pnpm run dev

reeceorbuck commented 4 months ago

I think I have a similar error- broke between 1.43.5 -> 1.43.6 and still failing in 1.44.0 importing from "npm:@azure/identity" will fail as cannot read properties of undefined (process.versions).

The debugger shows the process class is completely missing several properties: versions, env (your error), and several others.

tesharp commented 4 months ago

Same problem. Have to revert to 1.43.5 for azure/identity to work.

bartlomieju commented 4 months ago

@reeceorbuck @tesharp could you please share some reproduction code that causes the failure you're describing?

reeceorbuck commented 4 months ago

import { ClientSecretCredential } from "npm:@azure/identity"; const test = new ClientSecretCredential("a","b","c",);

A script with these two lines will throw.

reeceorbuck commented 4 months ago

@reeceorbuck @tesharp could you please share some reproduction code that causes the failure you're describing?

Just responded with short piece of code that shows my issue. Sorry I'm totally unfamiliar with GitHub conventions

bartlomieju commented 4 months ago

Thanks, I can now reproduce the problem.

birkskyum commented 2 months ago

The error now is (deno 1.45.5+6522478):

 ERROR  process is not defined                                                                            

instead of the

 ERROR  Cannot read properties of undefined (reading 'env')
birkskyum commented 2 months ago

Related to

birkskyum commented 1 month ago

I'll focus on triaging this for Deno 2, which prompts this install error instead:

birkskyum commented 1 month ago

deno task dev show this on localhost:

Screenshot 2024-09-24 at 11 38 55

server terminal show

Task dev vinxi dev
vinxi v0.3.14
vinxi starting dev server
[sentry-vite-plugin] Warning: No auth token provided. Will not create release. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/
[sentry-vite-plugin] Warning: No auth token provided. Will not upload source maps. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/

♻️  Generating routes...
✅ Processed routes in 93ms
[sentry-vite-plugin] Info: Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.

  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

ServerFn Request: /Users/admin/repos/deno-kitchensink/tanstack.com/app/server/sponsors.ts - $$function0

Missing github credentials, returning mock data.
Missing airtable credentials, returning mock data.
Missing airtable credentials, returning mock data.
Missing airtable credentials, returning mock data.
Missing github credentials, returning mock data.
ServerFn Response: 200
 - Payload: []

This output is alright, but had it been run with another runtime, the output would have continued with this and actually loaded the website:


1:41:24 AM [vite] ✨ new dependencies optimized: react-icons/md, tailwind-merge, @orama/react-components, react-icons/fa, @tanstack/start/client-runtime, react-icons/im, airtable, axios, @octokit/rest, @octokit/graphql
1:41:24 AM [vite] ✨ optimized dependencies changed. reloading
ServerFn Request: /Users/admin/repos/deno-kitchensink/tanstack.com/app/server/sponsors.ts - $$function0

ServerFn Response: 200
 - Payload: []

1:41:25 AM [vite] ✨ new dependencies optimized: @visx/hierarchy, @visx/responsive
1:41:25 AM [vite] ✨ optimized dependencies changed. reloading
ServerFn Request: /Users/admin/repos/deno-kitchensink/tanstack.com/app/server/sponsors.ts - $$function0

ServerFn Response: 200
 - Payload: []