yarbsemaj / sveltekit-adapter-lambda

An adapter to build a SvelteKit app into a lambda ready for deployment with lambda proxy via the Serverless Framework or CDK.
https://www.npmjs.com/package/@yarbsemaj/adapter-lambda
MIT License
77 stars 16 forks source link

Update to 401+ #17

Closed nickmenow closed 2 years ago

nickmenow commented 2 years ago

Hey @yarbsemaj

I recently updated to 401 and made code changes to handle the import { env } from '$env/dynamic/private'; for environment variables. Wondering if you can update the project to accommodate?

Thank you for your help. This is a great project to work with.

Best,

Nick

yarbsemaj commented 2 years ago

Hi @nickmenow, thank you for making me aware of this change, i will be adding support for this imminently

yarbsemaj commented 2 years ago

Hi @nickmenow Iv published a new release that i believe addresses this issue, this has been tagged with v0.11.0

nickmenow commented 2 years ago

Hi @yarbsemaj Thank you for the update. Perhaps there is an issue that is a little deeper than this lib.

When on sveltekit @401 I put in a console.log(process.env) above the app.init({ env: process.env }); line and it only contains the AMZ single env key value. [DEPLOYED TO LAMBDA]

When I revert back to the sveltekit @350 tag that I was on the process.env contains all the ENVs that I have in the Lambda > Configuration > Environment Variables. So something is happening where process.env is not containing the environment variables even before the app.init call. [DEPLOYED TO LAMBDA]

This is what the single env looks like on @401 when I console.log(process) in the serverless.js file: env: { _X_AMZN_TRACE_ID: 'Root=1-62f1427e-23cee3dc20721dc40a8992c3;Parent=75a39d072a6f6b03;Sampled=0' }

Also when built locally then previewed locally all process.env's are there without issue but they are pulled from a .env.[stage] file locally.

yarbsemaj commented 2 years ago

Hummmm, that is a weird issue, amazon injects the environment variables when init'ing the function, ill investigate and get back to you

nickmenow commented 2 years ago

Thank you for your help. I'll keep researching also. Will let you know if I find something.

nickmenow commented 2 years ago

I have a work around that uses the .env.[environment] files and using $env/static/private.