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

The netlify CLI attempts to access the network despite the --offline option #5015

Open
swiing opened this issue Aug 30, 2022 · 4 comments
Open
Labels
type: bug code to address defects in shipped code

Comments

@swiing
Copy link

swiing commented Aug 30, 2022

Describe the bug

Documentation for the dev command says that the option 'offline (boolean) - disables any features that require network access'.

However, this seems inaccurate wrt edge function environment.

Running netlify dev --offline when the network connectivity is not available starts ok, but eventually throws.

Steps to reproduce

1- cut network connectivity.
2- run npx netlify dev --offline

npx netlify dev --offline
◈ Netlify Dev ◈
◈ No app server detected. Using simple static server
◈ Running static server from "www-public-new/public"

◈ Static server listening to 3999
⠋ Setting up the Edge Functions environment. This may take a couple of minutes.
   ┌─────────────────────────────────────────────────┐
   │                                                 │
   │   ◈ Server now ready on http://localhost:8888   │
   │                                                 │
   └─────────────────────────────────────────────────┘

⠋ Setting up the Edge Functions environment. This may take a couple of minutes.FetchError: request to https://dl.deno.land/release/v1.20.3/deno-x86_64-unknown-linux-gnu.zip failed, reason: getaddrinfo EAI_AGAIN dl.deno.land

and then the CLI throws.

Configuration

No response

Environment

System:
OS: Linux 5.10 Ubuntu 20.04 LTS (Focal Fossa)
CPU: (12) x64 AMD Ryzen 5 PRO 5650U with Radeon Graphics
Memory: 3.26 GB / 5.65 GB
Container: Yes
Shell: 5.0.16 - /bin/bash
Binaries:
Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm

@swiing swiing added the type: bug code to address defects in shipped code label Aug 30, 2022
@tinfoil-knight
Copy link
Contributor

@swiing I'm not able to reproduce this. I've attached the output I'm getting below.

Is the repository you're working on public? (If yes, could you share it)

Do you have any specific configuration in netlify.toml? Also, could you share the CLI version you were using?

ncli dev --offline
◈ Netlify Dev ◈
◈ No app server detected. Using simple static server
◈ Unable to determine public folder to serve files from. Using current working directory
◈ Setup a netlify.toml file with a [dev] section to specify your dev server settings.
◈ See docs at: https://cli.netlify.com/netlify-dev#project-detection
◈ Running static server from "5051-redirect-us"
◈ Setting up local development server
 ​
────────────────────────────────────────────────────────────────
  Netlify Build
────────────────────────────────────────────────────────────────
 ​
❯ Version
  @netlify/build 27.18.3
 ​
❯ Flags
  offline: true
 ​
❯ Current directory
  /Users/kunal/Desktop/myfolder.nosync/oss/p-cli-test/5051-redirect-us
 ​
❯ Config file
  /Users/kunal/Desktop/myfolder.nosync/oss/p-cli-test/5051-redirect-us/netlify.toml
 ​
❯ Context
  dev
 ​
────────────────────────────────────────────────────────────────
  1. Run command for local development
────────────────────────────────────────────────────────────────
 ​

◈ Static server listening to 3999
 ​
(dev.command completed in 2ms)

   ┌─────────────────────────────────────────────────┐
   │                                                 │
   │   ◈ Server now ready on http://localhost:8888   │
   │                                                 │
   └─────────────────────────────────────────────────┘

@tinfoil-knight
Copy link
Contributor

@jackiewmacharia Do you know how to reset the cache for the packages that the edge functions environment downloads? Would help me in reproducing the error faced by the user above.

I was looking here:

try {
const bundler = await import('@netlify/edge-bundler')
const distImportMapPath = getPathInProject([DIST_IMPORT_MAP_PATH])
const runIsolate = await bundler.serve({
...getDownloadUpdateFunctions(),
certificatePath,
debug: env.NETLIFY_DENO_DEBUG === 'true',
distImportMapPath,
formatExportTypeError: (name) =>
`${NETLIFYDEVERR} ${chalk.red('Failed')} to load Edge Function ${chalk.yellow(
name,
)}. The file does not seem to have a function as the default export.`,
formatImportError: (name) =>
`${NETLIFYDEVERR} ${chalk.red('Failed')} to run Edge Function ${chalk.yellow(name)}:`,
importMaps,
inspectSettings,
port,

But couldn't pin-point what to do to clear the cache so that I can receive the error message described in the issue.

Setting up the Edge Functions environment. This may take a couple of minutes.FetchError: request to https://dl.deno.land/release/v1.20.3/deno-x86_64-unknown-linux-gnu.zip failed, reason: getaddrinfo EAI_AGAIN dl.deno.land

@eduardoboucas
Copy link
Member

This is an interesting one. On the one hand, it feels like we should respect --offline and not download the Deno CLI or any Deno modules, but that means not being able to run edge functions unless everything has been cached locally.

@swiing
Copy link
Author

swiing commented Oct 3, 2022

@tinfoil-knight , my repo is not public, but I believe it is pretty "standard".

My CLI version: netlify-cli/10.4.0 wsl-x64 node-v16.16.0

Ironically, I actually can't reproduce myself. I guess because I have everything in cache by now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

3 participants