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

This function has crashed – TypeError - (0 , import_slicedToArray2.default) is not a function #217

Closed
kevinreber opened this issue Nov 11, 2023 · 3 comments
Labels
Ecosystem: Frameworks type: bug code to address defects in shipped code

Comments

@kevinreber
Copy link

kevinreber commented Nov 11, 2023

FYI: Originally started this thread in the Netlify Community: https://answers.netlify.com/t/remix-this-function-has-crashed-typeerror-0-import-slicedtoarray2-default-is-not-a-function/106308

Summary

I recently upgraded a Remix app I have deployed on Netlify from v1 to v2 by following the directions listed here:

You can see my related PRs here:

References

Looking at the logs it says my build is marked as “Complete”, but when I visit the deployed site I see the following message

This function has crashed

An unhandled error in the function code triggered the following message:
TypeError - (0 , import_slicedToArray2.default) is not a function

Stack trace
TypeError: (0 , import_slicedToArray2.default) is not a function
    at setTwoToneColor (/var/task/.netlify/functions-internal/server.js:1490:128)
    at Object.<anonymous> (/var/task/.netlify/functions-internal/server.js:1501:1)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/var/task/server.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)

Connection details
Netlify internal ID: 01HEYB4Z9T4ZBRKC5GK7SRBZ0F

image

Build Logs

8:42:02 PM: Netlify Build                                                 
8:42:02 PM: ────────────────────────────────────────────────────────────────
8:42:02 PM: ​
8:42:02 PM: ❯ Version
8:42:02 PM:   @netlify/build 29.26.3
8:42:02 PM: ​
8:42:02 PM: ❯ Flags
8:42:02 PM:   baseRelDir: true
8:42:02 PM:   buildId: 654f05f6e88e2e000862a54e
8:42:02 PM:   deployId: 654f05f6e88e2e000862a550
8:42:02 PM: ​
8:42:02 PM: ❯ Current directory
8:42:02 PM:   /opt/build/repo
8:42:02 PM: ​
8:42:02 PM: ❯ Config file
8:42:02 PM:   /opt/build/repo/netlify.toml
8:42:02 PM: ​
8:42:02 PM: ❯ Context
8:42:02 PM:   production
8:42:02 PM: ​
8:42:02 PM: build.command from netlify.toml                               
8:42:02 PM: ────────────────────────────────────────────────────────────────
8:42:02 PM: ​
8:42:02 PM: $ remix build
8:42:02 PM:  info  building... (NODE_ENV=production)
8:42:05 PM:  info  built (2.7s)
8:42:05 PM: ​
8:42:05 PM: (build.command completed in 3.2s)
8:42:05 PM: ​
8:42:05 PM: Functions bundling                                            
8:42:05 PM: ────────────────────────────────────────────────────────────────
8:42:05 PM: ​
8:42:05 PM: Packaging Functions from .netlify/functions-internal directory:
8:42:05 PM:  - server.js
8:42:05 PM: ​
8:42:12 PM: ​
8:42:12 PM: (Functions bundling completed in 7.1s)
8:42:12 PM: ​
8:42:20 PM: (Netlify Build completed in 17.9s)
8:42:25 PM: Section completed: building
8:42:33 PM: Finished processing build request in 1m5.639s

Files setup

netlify.toml

[build]
  command = "remix build"
  publish = "public"

[dev]
  command = "remix watch"
  port = 3000

[[redirects]]
  from = "/*"
  to = "/.netlify/functions/server"
  status = 200

[[headers]]
  for = "/build/*"
  [headers.values]
    "Cache-Control" = "public, max-age=31536000, s-maxage=31536000"

package.json

{
  "private": true,
  "sideEffects": false,
  "type": "module",
  "scripts": {
    "build": "remix build",
    "dev": "yarn run check-env-file && remix dev",
    "start": "netlify dev",
    "typecheck": "tsc",
    "check-env-file": "node ./scripts/check-env-file.mjs",
    "postinstall": "prisma generate",
    "stripe:listen": "stripe listen --forward-to localhost:3000/webhook",
    "format": "prettier --write .",
    "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint ."
  },
  "dependencies": {
    "@ant-design/colors": "^7.0.0",
    "@ant-design/icons": "^5.0.1",
    "@aws-sdk/client-s3": "^3.363.0",
    "@netlify/functions": "^2.3.0",
    "@netlify/remix-adapter": "^2.2.0",
    "@prisma/client": "^4.13.0",
    "@remix-run/css-bundle": "^2.2.0",
    "@remix-run/express": "^2.2.0",
    "@remix-run/node": "2.2.0",
    "@remix-run/react": "2.2.0",
    "antd": "4.24.10",
    "cross-env": "^7.0.3",
    "dotenv": "^16.0.3",
    "isbot": "^3.6.8",
    "moment": "^2.29.4",
    "openai": "^3.2.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "remix-auth": "^3.6.0",
    "remix-auth-socials": "^2.0.5",
    "stripe": "^12.3.0"
  },
  "devDependencies": {
    "@remix-run/dev": "2.2.0",
    "@remix-run/eslint-config": "2.2.0",
    "@remix-run/serve": "2.2.0",
    "@types/eslint": "^8.44.3",
    "@types/react": "^18.0.35",
    "@types/react-dom": "^18.0.11",
    "eslint": "^8.38.0",
    "eslint-config-airbnb": "^19.0.4",
    "eslint-config-prettier": "^9.0.0",
    "prettier": "^3.0.3",
    "prisma": "^4.13.0",
    "tailwindcss": "^3.3.3",
    "typescript": "^4.9.5",
    "zx": "7.0.8"
  },
  "engines": {
    "node": "20.5.0"
  }
}

remix.config.js

/** @type {import('@remix-run/dev').AppConfig} */
import { config } from "@netlify/remix-adapter";

export default {
  ...config,
  serverDependenciesToBundle: [
    "@ant-design/icons",
    /^@ant-design\/icons-svg.*/,
    /^rc-util.*/,
  ],
  serverModuleFormat: "cjs",
};
@mbsyaswanth
Copy link

This is not fixed yet ? I ended up with the same error. I tried to deploy a freshly created netlify vite template.

@malik991
Copy link

This is not fixed yet ? I ended up with the same error. I tried to deploy a freshly created netlify vite template.

i also faced the same issue wi passport js function.. any solution please

@serhalp serhalp added the type: bug code to address defects in shipped code label May 24, 2024
@serhalp
Copy link
Contributor

serhalp commented Sep 17, 2024

@kevinreber We're sorry you never got a response here. I hope you were able to resolve your issue. Since this is quite old, I'm going to close it. @mbsyaswanth @malik991 Please feel free to open new issues or (even better) post at https://answers.netlify.com/ if you're still having issues.

@serhalp serhalp closed this as not planned Won't fix, can't repro, duplicate, stale Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ecosystem: Frameworks type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

4 participants