#Hey guy's I'm using Netlify SSR, but I'm overpassing de 50MB of upload

37 messages · Page 1 of 1 (latest)

foggy musk
#

This is my package.json

{
  "name": "@example/basics",
  "type": "module",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "dev": "astro dev",
    "start": "astro dev",
    "build": "astro build",
    "preview": "astro preview",
    "astro": "astro",
    "start:dev": "astro dev"
  },
  "dependencies": {
    "@astrojs/netlify": "^1.1.0",
    "@astrojs/react": "^1.1.4",
    "astro": "^1.3.0",
    "firebase": "9.10.0"
  }
}

Any tip or idea on what to make here? ): Im really stucked

coarse mica
#

You can try moving dependencies to devDependencies and see if that helps at all.

modest brook
#

Hi. I don’t think your package.json is the source of the issue. Could you maybe provide a repository that we can look at?

foggy musk
foggy musk
foggy musk
modest brook
foggy musk
#

Yeah! that was, I added you to the repo so you could see it lol

#

thank you, folk. You're really cool 😎

modest brook
#

I’m sorry, but I never used netlify and I can’t see anything wrong with your repo at first glance. I recommended you put it in a repo so others who do could take a look at it

foggy musk
#

@coarse mica i dunnoif you know something

coarse mica
#

I'll take a peek!

coarse mica
#

So I see that you have this in your netlify.toml file:

[functions]
  external_node_modules = ["astro"]
  included_files = ["!node_modules/A_LARGE_MODULE/**/*"]

[build]
  command = "npm run build"
  publish = "dist"

As far as I can tell, you don't need to include Astro in this way, and you shouldn't have to manually declare anything under [functions]: https://docs.astro.build/en/guides/deploy/netlify/

Here, the default netlify.toml is defined like this:

[build]
  command = "npm run build"
  publish = "dist"

I think though you were trying to troubleshoot the build error, and that's why you included these? (Going off the Netlify Function docs here: https://docs.netlify.com/functions/optional-configuration/?fn-language=ts#bundle)

Astro Documentation

How to deploy your Astro site to the web on Netlify.

#

When I just cloned your repo and tried to deploy via the Netlify UI I got the error The function "ENTRY" is larger than the 50MB limit.

I cloned your repo, did a fresh npm install, reset your nelify.toml to the following:

[build]
  command = "npm run build"
  publish = "dist"

And then used the Netlify CLI to deploy, and everything built without an issue.

#

But I see that by removing this

[functions]
  external_node_modules = ["astro"]
```

The `ENTRY` function fails to run as the Netlify CLI warns. And when I added back in the `external_node_modules` setting, it breaks the deploy saying it's over 50MB.
#

So I think we can pinpoint this as the issue!

#

The entry function is otherwise failing with the following log:

ERROR  Invoke Error     {"errorType":"TypeError","errorMessage":"Cannot read properties of undefined (reading 'map')","stack":["TypeError: Cannot read properties of undefined (reading 'map')","    at default (/var/task/.netlify/functions-internal/entry.js:54314:173)","    at renderChild2 (/var/task/.netlify/functions-internal/entry.js:53083:25)","    at processTicksAndRejections (node:internal/process/task_queues:96:5)","    at runNextTicks (node:internal/process/task_queues:65:3)","    at processImmediate (node:internal/timers:437:9)","    at async renderSlot2 (/var/task/.netlify/functions-internal/entry.js:53039:22)"]}
#

Okay, using Netlify CLI to be able to test with netlify dev, it's much easier to debug!

foggy musk
#

DUDE WHAT? OMG you’re FREAKING AWESOME

coarse mica
#

Sorry @foggy musk , I tried to take a look but since I haven't used Netlify for SSR this is all a bit over my head.

I received the following errors when trying to run netlify dev:

 Error - require() of ES Module /home/kevin/Command-website-controller-test/.netlify/functions-serve/entry/src/node_modules/astro/dist/core/app/index.js from /home/kevin/Command-website-controller-test/.netlify/functions-serve/entry/src/.netlify/functions-internal/entry.js not supported. Instead change the require of index.js in /home/kevin/Command-website-controller-test/.netlify/functions-serve/entry/src/.netlify/functions-internal/entry.js to a dynamic import() which is available in all CommonJS modules. 

Which doesn't make much sense, because Netlify generates the entry.js function. This error seems to be caused by adding the suggested

  external_node_modules = ["astro"]
``` to the `netlify.toml`. So I think that may be a misleading CLI message.
#

When you set the netlify.toml to the most basic config, you can run netlify dev successfully, but the render function crashes because "commands" in the InteractionCard.astro is undefined:

Cannot read properties of undefined (reading 'map')
  Code:
      30 |     <InputContainer headerText="Commands">
    > 31 |       {
         |       ^
      32 |         commands.map((element) => {
      33 |           //prettier-ignore
      34 |           return (

Not sure if that's because I can't access the Firestore from my cloned repo or due to a bug in your code.

foggy musk
#

Im looking at it, it’s weird cause when I run it with “npm Tun start” it works perfect and takes the commands data perfectly

coarse mica
#

Interestingly, if I run npm run build (astro build) THEN run netlify dev, I get the data but it fails to serve any javascript or CSS thinkdrops

foggy musk
#

YES! Exactly

#

It happened to me

coarse mica
#

To be honest, I have no clue what is going on here because I haven't looked into how the Astro Netlify integration works for SSR.

foggy musk
#

Nah don’t worry, you’ve helped me A LOT, maybe is something with my code, I’ll try to make it step by step again, but now testing every few steps if it builds

coarse mica
#

🫡 Buena suerte camarada -- sorry I couldn't be of more help!

foggy musk
#

No, dude you helped me a lot (:

#

You’re great

#

foggy musk
#

Hey! @coarse mica @modest brook

I literally solved it making everything again clean. Obviously I made a lot of copy/paste is not that I rebuilt everything, but GREAT NEWS! Now everything works smooooooth 😎 thank you a lot!

You’re great 🥰

#

If you need any info, I could share with you the Repo

coarse mica
#

So glad that things worked out!

#

It also inspired me to install and use Netlify-CLI tool finally and WOW -- I was missing out! So thanks to you as well!

tall mauve