Closed eric-naguras closed 2 years ago
Hi @eric-naguras ! Thank You for your interest in my project and bringing this issue to my attention. The issue you are experiencing look to be due to a change in the svelte kit adapter API between when I created this adapter, and the present day. They mention the possibility of this on there website. I will issue an updated version of the adapter shortly to resolve these issues
@eric-naguras I have updated the adapter for the latest svelte kit build, it should now work for your project
Thank you James for updating the package. It works like a charm now.
To deploy I used the AWS CDK. I'm including my CDK stack file below. You might want to add this to your README.md for people who don't know the Serverless framework or who don't like it. AWS CDK is free and easy to use.
// This is Version 2 of the CDK
const { Stack } = require('aws-cdk-lib');
const { Construct } = require("constructs");
const apigateway = require("aws-cdk-lib/aws-apigateway");
const lambda = require("aws-cdk-lib/aws-lambda");
class CrmBackendServiceStack extends Stack {
/**
*
* @param {Construct} scope
* @param {string} id
* @param {StackProps=} props
*/
constructor(scope, id, props) {
super(scope, id, props);
// The code that defines your stack goes here
new CRMBackendService(this, 'CRMBackend')
}
}
class CRMBackendService extends Construct {
constructor(scope, id) {
super(scope, id);
const handler = new lambda.Function(this, "CRMBackendHandler", {
runtime: lambda.Runtime.NODEJS_14_X, // So we can use async in widget.js
code: lambda.Code.fromAsset("resources"), // Copy files from /build/server into resources
handler: "serverless.handler",
environment: {}
});
new apigateway.LambdaRestApi(this, 'crmbackend-api', {
handler: handler,
description: "This service serves crmbackend.",
restApiName: "CRMBackend Service",
proxy: true
});
}
}
module.exports = { CrmBackendServiceStack }
@eric-naguras thanks for the update, I will take your consideration on board re documentation, Iv also updated the package again to support routing via a lambda@edge function and included the s3 upload as part of the serverless config. As such is now possible to deploy your code with one command.
Hi, Thanks for making this adapter, I'd love to use it.
I have a very simple Sveltekit app that only has endpoints, no assets or anything static. When I try to build it with your adapter I get the following build error: `
The app works without problems with 'svelte-kit dev" and using the Cloudflare adapter it also runs without issues on Cloudflare Workers.
You can find the repo here : https://github.com/NagurasDemoApp/crm-backend-sveltekit-aws-lambda
If you open the repo with this link https://gitpod.io/#https://github.com/NagurasDemoApp/crm-backend-sveltekit-aws-lambda you wil get a VSCode instance in the browser and can look at the error by doing a build in the integrated terminal from VSCode.
If you run the app in dev mode you can test if it's working by opening the the file login.http in the folder http-tests. On the top line you should see "Send Request". By clicking on that line, it will send a request to the app and you will see a return. Works a bit like Postman by using this extension (which will be available already if you open the repo via Gitpod.
Thanks.