You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the bug
The SvelteKit adapter for AWS does not support using top-level domains (e.g., domain.com) as FQDN values. It only works correctly with subdomains (e.g., subdomain.domain.com) and third level domains (e.g. domain.co.uk).
In the current production version, the domainName variable incorrectly receives the value "com" when using "google.com" as an FQDN. Instead, it should be assigned the correct value, which in this case is "google.com".
Steps to reproduce the behavior:
Set up a project using the SvelteKit adapter for AWS.
Set the FQDN value to a top-level domain (e.g., domain.com).
Deploy the project using AWS CDK.
Encounter the error: "[Error at /sveltekit-adapter-aws-webapp] Found zones: [] for dns:com, privateZone:undefined, vpcId:undefined, but wanted exactly 1 zone"
Expected behavior
The adapter should work correctly with top-level domains, third level domains and subdomains as FQDN values.
Additional context
A potential fix for this issue is to modify the adapter-stack.js file to handle both second-level top-level domains (e.g., domain.co.uk) and regular top-level domains (e.g., domain.com):
It splits the FQDN string into an array of domain parts by splitting it on the period character (.).
It checks if the domain has a second-level top-level domain (TLD) by checking if there are at least 3 domain parts and if the second last part of the domain has a length of 2 characters (e.g., co in domain.co.uk).
It constructs the main domain by slicing the domainParts array. If the domain has a second-level TLD, it takes the last three parts of the array; otherwise, it takes the last two parts. Finally, it joins the resulting array back into a string using the period character (.).
With this code, the main domain should be correctly determined for cases like www.domain.com, domain.com, domain.co.uk, and subdomain.domain.co.uk.
The text was updated successfully, but these errors were encountered:
When attempting to deploy with a top level domain I get the error Found zones: [] for dns:com, privateZone:undefined, vpcId:undefined, but wanted exactly 1 zone which lead me to this same conclusion. replacing my FQDN with www.mydomain.com fixes the issue.
Description of the bug
The SvelteKit adapter for AWS does not support using top-level domains (e.g., domain.com) as FQDN values. It only works correctly with subdomains (e.g., subdomain.domain.com) and third level domains (e.g. domain.co.uk).
In the current production version, the domainName variable incorrectly receives the value "com" when using "google.com" as an FQDN. Instead, it should be assigned the correct value, which in this case is "google.com".
Steps to reproduce the behavior:
Expected behavior
The adapter should work correctly with top-level domains, third level domains and subdomains as FQDN values.
Additional context
A potential fix for this issue is to modify the adapter-stack.js file to handle both second-level top-level domains (e.g., domain.co.uk) and regular top-level domains (e.g., domain.com):
const domainParts = ((_b = process.env.FQDN) === null || _b === void 0 ? void 0 : _b.split('.')) || [];
const isSecondLevelTLD = domainParts.length >= 3 && domainParts[domainParts.length - 2].length === 2;
const domainName = domainParts.slice(isSecondLevelTLD ? -3 : -2).join('.');
This code works as follows:
With this code, the main domain should be correctly determined for cases like www.domain.com, domain.com, domain.co.uk, and subdomain.domain.co.uk.
The text was updated successfully, but these errors were encountered: