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

Unexpected Server Error with JavaScript #4467

Closed
tempcoderr opened this issue Nov 1, 2022 · 17 comments
Closed

Unexpected Server Error with JavaScript #4467

tempcoderr opened this issue Nov 1, 2022 · 17 comments
Assignees
Labels
bug Something isn't working package:create-remix

Comments

@tempcoderr
Copy link

What version of Remix are you using?

1.7.4

Steps to Reproduce

I created a Remix app using the npx create-remix@latest command and then choosing Just the basics and then Remix App Server and then JavaScript, But when I then run the server it gives me the following error:

Unexpected Server Error

TypeError: isbot is not a function

If instead of Javascript I choose Typescript, the app works fine.

Expected Behavior

The app should load and run.

Actual Behavior

Gives an Unexpected Server Error error.

@machour
Copy link
Collaborator

machour commented Nov 1, 2022

Hi @tempcoderr, I could not reproduce the issue, see complete installation log below.
isbot is used in app/entry.server.jsx and is listed as a dependency in package.json

Did you run npm install ?

🍺  ~ $ npx create-remix@latest
Need to install the following packages:
  create-remix@latest
Ok to proceed? (y) y
npm WARN deprecated @types/keyv@4.2.0: This is a stub types definition. keyv provides its own type definitions, so you do not need this installed.
? Where would you like to create your app? bug-4467
? What type of app do you want to create? Just the basics
? Where do you want to deploy? Choose Remix App Server if you're unsure; it's easy to change deployment targets. Remix App Server
? TypeScript or JavaScript? JavaScript
? Do you want me to run `npm install`? Yes
⠏ Creating your app…⠋ Migrating template to JavaScript…Processing 1 files...
Spawning 1 workers...
Sending 1 files to free worker...
⠴ Migrating template to JavaScript… SKIP /Users/didou/bug-4467/remix.env.d.ts
All done.
Results:
0 errors
0 unmodified
1 skipped
0 ok
Time elapsed: 0.387seconds
npm WARN deprecated @types/keyv@4.2.0: This is a stub types definition. keyv provides its own type definitions, so you do not need this installed.
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated

added 1041 packages, and audited 1042 packages in 1m

224 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
💿 That's it! `cd` into "/Users/didou/bug-4467" and check the README for development and deploy instructions!
🍺  ~ $ cd bug-4467/
🍺  ~/bug-4467 $ npm run dev

> dev
> remix dev

Watching Remix app in development mode...
💿 Built in 156ms
Remix App Server started at http://localhost:3002 (http://192.168.1.6:3002)
GET / 200 - - 28.032 ms

@machour machour added the needs-response We need a response from the original author about this issue/PR label Nov 1, 2022
@tempcoderr
Copy link
Author

I created a new Remix app and the issue still persists. Here is the process which I followed:

$ npx create-remix@latest new
? What type of app do you want to create? Just the basics
? Where do you want to deploy? Choose Remix App Server if you're unsure; it's easy to change deployment targets. Remix
App Server
? TypeScript or JavaScript? JavaScript
? Do you want me to run `npm install`? Yes
⠙ Migrating template to JavaScript…Processing 5 files...
Spawning 5 workers...
Sending 1 files to free worker...
Sending 1 files to free worker...
Sending 1 files to free worker...
Sending 1 files to free worker...
Sending 1 files to free worker...
⠼ Migrating template to JavaScript… SKIP D:/Projects/Remix Temp/new/remix.env.d.ts
 OKK D:/Projects/Remix Temp/new/app/entry.client.tsx
 OKK D:/Projects/Remix Temp/new/app/root.tsx
 OKK D:/Projects/Remix Temp/new/app/routes/index.tsx
 OKK D:/Projects/Remix Temp/new/app/entry.server.tsx
All done.
Results:
0 errors
0 unmodified
1 skipped
4 ok
Time elapsed: 2.203seconds
npm WARN deprecated @types/keyv@4.2.0: This is a stub types definition. keyv provides its own type definitions, so you do not need this installed.
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated

added 1040 packages, and audited 1041 packages in 2m

224 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
💿 That's it! `cd` into "D:\Projects\Remix Temp\new" and check the README for development and deploy instructions!

And now when I run the app, I get the error.

$ npm run dev

> dev
> remix dev

Watching Remix app in development mode...
💿 Built in 613ms
Remix App Server started at http://localhost:3000 (http://192.168.1.24:3000)
TypeError: isbot is not a function
    at handleRequest (D:\Projects\Remix Temp\new\app\entry.server.jsx:19:10)
    at handleDocumentRequest (D:\Projects\Remix Temp\new\node_modules\@remix-run\server-runtime\dist\server.js:431:20)
    at requestHandler (D:\Projects\Remix Temp\new\node_modules\@remix-run\server-runtime\dist\server.js:72:18)
    at D:\Projects\Remix Temp\new\node_modules\@remix-run\express\dist\server.js:39:22
GET / 500 - - 99.882 ms

@machour machour removed the needs-response We need a response from the original author about this issue/PR label Nov 2, 2022
@machour
Copy link
Collaborator

machour commented Nov 2, 2022

Could you check if you have isbot in your node_modules? What version got installed? What does console.log(isbot) right after its import in server entry yields?

@machour machour added the needs-response We need a response from the original author about this issue/PR label Nov 2, 2022
@tempcoderr
Copy link
Author

tempcoderr commented Nov 3, 2022

There is an isbot folder in the node_modules folder, and its version is 3.6.2. When I write the following statement,

const isbot = require("isbot").default;
console.log("isbot", isbot);

It returns isbot undefined.

@machour
Copy link
Collaborator

machour commented Nov 3, 2022

And what about:

const isbot = require("isbot");
console.log("isbot", isbot)

Also, what node version are you running? 🙏

@tempcoderr
Copy link
Author

@machour Thanks for the reply. After changing const isbot = require("isbot").default; to const isbot = require("isbot");, the app has started and is working fine, and the value of isbot becomes isbot [Function: isbot].

@machour machour removed the needs-response We need a response from the original author about this issue/PR label Nov 3, 2022
@machour
Copy link
Collaborator

machour commented Nov 3, 2022

Thank you for the feedback 🙌🏼

@MichaelDeBoey do you know what might be going wrong with the TS => JS conversion here?

@aayushbisen
Copy link

I also face this issue today.

Remix Version: 1.7.5
Node Version: v18.12.0

Changing const isbot = require("isbot").default to const isbot = require("isbot") fixed the issue.

@PhilipHassialis
Copy link

PhilipHassialis commented Nov 13, 2022

I also face this issue today.

Remix Version: 1.7.5 Node Version: v18.12.0

Changing const isbot = require("isbot").default to const isbot = require("isbot") fixed the issue.

Can confirm similar behaviour.

Remix v. 1.7.5

Node version 16.13.1

Selected "Just the basics", "Remix Server", "Javascript". As soon as I changed the isbot require, the server automatically re-rendered index.jsx and it was displayed properly in the browser.

@cbenjamin2009
Copy link

I can confirm the same behavior is happening when choosing "Just the Basics" with "Remix Server" and "JavaScript". Remove the '.default;' from 'entry.server.jsx' on the 'const isbot = require("isbot")' line solves the problem.

@sannamalai176

This comment was marked as off-topic.

@machour
Copy link
Collaborator

machour commented Nov 18, 2022

@sannamalai176 this seems like another problem. Can you open a new discussion (Q&A category) please? 🙏🏼

@machour machour added bug Something isn't working and removed bug:unverified labels Nov 18, 2022
@ghost

This comment was marked as off-topic.

@machour
Copy link
Collaborator

machour commented Nov 19, 2022

@moutafatin1 Your error message have nothing to do with this issue. Please open a new question in the Discussions tab.

@alexnguyennz
Copy link

I can confirm the same behavior is happening when choosing "Just the Basics" with "Remix Server" and "JavaScript". Remove the '.default;' from 'entry.server.jsx' on the 'const isbot = require("isbot")' line solves the problem.

+1 this is still happening with these exact options.

@xHomu
Copy link
Contributor

xHomu commented Nov 28, 2022

We were able to narrow down this issue to be related to some weirdness with jscodeshift in certain environments in this thread: https://discord.com/channels/770287896669978684/1046094365426208818

@pcattori
Copy link
Contributor

pcattori commented Aug 4, 2023

jscodeshift was removed as a dependency a couple version ago and this is no longer reproducible on recent versions (e.g. 1.19.2).

@pcattori pcattori closed this as completed Aug 4, 2023
@pcattori pcattori assigned pcattori and unassigned markdalgleish Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package:create-remix
Projects
No open projects
Status: Closed
Development

No branches or pull requests