question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is it possible to add custom netlify functions

See original GitHub issue

Hey there 👋

I’m trying to deploy my svelte kit app to netlify, which seems to be working perfectly, when using the adapter.

However, I also wanted to deploy a custom function of mine and I noticed that this function is never deployed to netlify. Only the function called render.

I also noticed that when I add my custom function to the specified functions directory and then run npm run build, my custom function is removed from the functions folder and only the render function is still there.

I’m wondering am I missing something here or is it currently not possible to add a custom function to netlify when using the adapter ?

Thanks in advance 🙇‍♂️

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:10
  • Comments:27 (11 by maintainers)

github_iconTop GitHub Comments

12reactions
ClaytonFarrcommented, May 23, 2021

@benmccann I think this is still a real issue and need.

There is unique Netlify functionality that doesn’t seem accessible via SvelteKit endpoints yet.

Two examples I’m currently encountering are -

  1. Not able to take advantage of specially named functions that trigger on events (https://docs.netlify.com/functions/trigger-on-events)
  2. Not able to access user context information from Netlify authentication product ‘Identity’; this is needed to be able to perform admin actions (https://docs.netlify.com/functions/functions-and-identity)

I’m not sure if / when it’ll make sense for SvelteKit to afford this ability via endpoints (esp if #2 is unique to Netlify only).

But, being able to create and include additional serverless functions in the build somehow (e.g. copying files from an aliased directory into the ‘build/functions’ directory) should make this work.

Without it, I’m finding myself running in circles trying to implement a full auth solution using Netlify.

If there’s a way to work around this in the short, that’d be great to know.

Thanks.

4reactions
sw-yxcommented, Jun 14, 2021

@ClaytonFarr yes i do think that there may be a way to handle this, but also the netlify adapter was probably not created with this usecase in mind so we may want to fix this uptstream. examples would help motivate the discussion.

fwiw i used to work at netlify and helped make netlify dev so thats why im volunteering since my background can probably help here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build functions - Netlify Docs
Create functions source files in TypeScript, JavaScript, and Go. Use environment variables with functions, manage dependencies, and test locally.
Read more >
Make Static Pages Dynamic With Netlify Edge Functions
Can you customize someone's experience without tons of client-side JavaScript or complex SSR? Alex Shyba will show us how Netlify Edge ...
Read more >
How to point a custom domain to a netlify function?
Edit: I tried adding redirects in the netlify.toml file, and that does work, but I'm still curious if there's a way to "directly"...
Read more >
Build your Backend with Netlify Functions in 20 Minutes
Netlify makes deploying your front end quick and easy, and Netlify functions makes running a serverless backend just as easy. In this guide,...
Read more >
Connect a custom domain | Firebase Hosting - Google
On this page · Set up your domain for Hosting. Step 1: Add domain; Step 2: Verify domain ownership; Step 3: Go live...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found