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

2146 Run netlify dev locally #2147

Merged
merged 4 commits into from
Jul 15, 2024

Conversation

Da-Colon
Copy link
Contributor

Closes #2146
This will allow the netlify function to properly work.

I'll let GPT explain the setup


  1. Application Port (targetPort):
    • Purpose: This is the port where your actual development server (Vite, in this case) is running. It’s where your application is served from during development.
    • Why Separate?: By running your development server on a separate port, you isolate the development environment and allow Netlify Dev to manage and reroute requests appropriately without interfering with the direct operation of the development server.
  2. Netlify Dev Proxy Port (port):
    • Purpose: Netlify Dev runs on this port. It acts as a proxy, handling requests to your functions, managing redirects, rewrites, and providing features like server-side logic that mirror your production environment on Netlify.
    • Why Proxy?: Using a proxy server allows you to integrate Netlify-specific features into your local development without modifying your application’s server configuration. The proxy intercepts requests and can inject additional functionality like serverless functions, which don’t run natively on Vite.

Now the way I have this currently setup changes the vite server to 8888 and netlify dev to run on 3000 allowing us to continue using 3000 as normal locally. But if we want to keeep the vite server setting along I can switch it back but we would need to use 8888 locally to use netlify function (might be fine to do that too)

Thoughts? @decentdao/engineering

Copy link

netlify bot commented Jul 13, 2024

Deploy Preview for decent-interface-dev ready!

Name Link
🔨 Latest commit 1cdaaa6
🔍 Latest deploy log https://app.netlify.com/sites/decent-interface-dev/deploys/66935b1d09088d0008603e83
😎 Deploy Preview https://deploy-preview-2147.app.dev.decentdao.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Da-Colon
Copy link
Contributor Author

Da-Colon commented Jul 13, 2024

Convinced my self otherwise on switching the vite port, I reverted that change

Copy link
Member

@adamgall adamgall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

I think it would also be cool to see an optional env var called something like SILENCE_NETLIFY_CONNECTION_ERRORS that you could set true on local. So that way we could still not run the netlify dev server and also not get those toasts.

Maybe that doesn't need to be in this PR though.

I guess I'm sayin: I like seeing this in the package json scripts, but I don't think I'll like to run the netlify dev server all the time just to silence that toast.

@DarksightKellar
Copy link
Contributor

Agree with Adam's comment re: SILENCE_NETLIFY_CONNECTION_ERRORS, but gonna merge as is cz I MUST HAVE THIS FEATURE.

@DarksightKellar DarksightKellar merged commit aae75e5 into develop Jul 15, 2024
7 checks passed
@DarksightKellar DarksightKellar deleted the issue/2146-local-netlify-function branch July 15, 2024 11:36
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

Successfully merging this pull request may close these issues.

Local Netlify Functions use
4 participants