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

service core:user:elysia-test: Uncaught ReferenceError: process is not defined at index.js:7397:27 #69

Closed
ryoppippi opened this issue Jul 22, 2023 · 5 comments

Comments

@ryoppippi
Copy link
Contributor

ryoppippi commented Jul 22, 2023

Related to: #58
I tried to run elysia on wrangler(cloudflare workers), and I got this error.
The code here below

import { Elysia, t } from "elysia";
// import { swagger } from "@elysiajs/swagger";

const app = new Elysia()
  // .use(swagger())
  .get("/", () => "Hello Elysia")
  .get("/id/:id", (context) => context.params.id)
  .post(
    "/post",
    async (event) => {
      const body = event.body;
      return body;
    },
    {
      body: t.Object({
        username: t.String(),
        password: t.String(),
      }),
    }
  );

export default app;

package.json

{
  "name": "hi-elysia",
  "version": "1.0.44",
  "scripts": {
    "dev": "wrangler dev src/index.ts"
  },
  "devDependencies": {
    "elysia": "0.6.0-alpha.2",
    "superjson": "^1.13.1",
    "tsx": "^3.12.7",
    "wrangler": "^3.3.0"
  },
  "module": "src/index.js"
}

The error message

⎔ Starting local server...
service core:user:elysia-test: Uncaught ReferenceError: process is not defined
  at index.js:7397:27
@ryoppippi
Copy link
Contributor Author

Oh, I'm sorry this is related to remix-run/remix#1285

@ryoppippi
Copy link
Contributor Author

Is it able to ignore ‘process’ variable if there is no process variable found

@ryoppippi ryoppippi reopened this Jul 23, 2023
@ryoppippi
Copy link
Contributor Author

ryoppippi commented Jul 23, 2023

I used the latest 0.6.0-alpha2
and I found that this error caused in error.ts

elysia/src/error.ts

Lines 4 to 5 in b2df605

const isProduction =
process.env.NODE_ENV === 'production' || process.env.ENV === 'production'

@SaltyAom
Copy link
Member

SaltyAom commented Aug 6, 2023

Is this issue solved with Elysia 0.6.0 stable?

@SaltyAom
Copy link
Member

As we can now use Elysia on Cloudflare worker since 0.6.1, I assume this problem is solved.

Feels free to reopen if the issue still persists.

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

No branches or pull requests

2 participants