-
-
Notifications
You must be signed in to change notification settings - Fork 463
Error: Source and destination must not be the same. When using useServerlessTraceTarget #461
Comments
@TuuZzee Could you post your directory structure? i.e. Are you in a monorepo and from which directory you are running |
It's a monorepo for this project, here is the current directory and file structure structure:
I am running the next build from the root of the project.
|
I try to use the Any thing I could give a try to ? |
@TuuZzee If you provide a simple reproduction of the problem in a repo I can access that would be greatly appreciated. I'll take a look at it asap. |
I have made a boilerplate here: https://github.com/TuuZzee/boilerplate-NextJS based on this issue. Just need to run the usual
|
Any luck with the repo I provided ? I am not sure I understand which I tried removing all non essentials files from the project to see if that affect anything(things like editor config files etc...), but it doesn't change the issue. |
Thanks for the repro! I've not had a had a chance to look into it but I'm hoping to get some time this weekend. |
@TuuZzee I haven’t been able to reproduce the issue using the repro. Are there any specific steps I need to take? |
I have the same problem.
Is there a solution such as exclude? |
@shoNagai Could you post your app directory structure? Include as much detail as you can please 🙂 |
@danielcondemarin Thank you.
Here is the main script.(package.json)
|
I am running into the same issue: error: 81s » sr-web » Error: Source and destination must not be the same. error Command failed with exit code 1. |
Here is my dir structure │ .gitignore |
@danielcondemarin i found the issue that is causing this error for my deployment. I have an api that uses html-validator. In my code if i comment out the require line (below); i no longer get the error. // version 5.1.14 I will be trying other stuff to get around this issue since I do need to validate an html snippet / string passed in via this api call. UPDATE:
thanks |
Seems like other projects have been hit by this issue: apache/cordova-android#692 |
I was also facing the same issue (getting serverless-next.js/packages/libs/lambda-at-edge/src/build.ts Lines 106 to 128 in d0a6300
I am not too familiar with the code, but it looks like it's copying serverless-next.js/packages/libs/lambda-at-edge/src/build.ts Lines 156 to 160 in d0a6300
In my case,
nodeFileTrace )
As a quick debug, I printed out the values of variables from
These files like the above fail due to It works for files in Example values
Quick Solution I quickly updated: serverless-next.js/packages/libs/lambda-at-edge/src/build.ts Lines 112 to 116 in d0a6300
build.js directly to filter filepaths that didn't contain node_modules , and the serverless command succeeds.
The above works (and is a quick fix if you're just deploying from a local machine, for CI/CD you'd have to find the @danielcondemarin will also try to get a minimal repro when I get time (can't share above code since it's private), but hopefully this is helpful as a start. FYI, I am running this on Mac OS 10.15.5 / Macbook Pro 16 |
Great work @dphang. I had traced the problem to build.js also, but didn't get much further. I can confirm that your solution fixes my build also. For my cases, the error was happening for files in the On an unrelated note: Now that my build deploys, I need to figure out why my lambda is 503ing... |
I got a workaround. |
@zoozalp I've tested this with 1.17.0-alpha.12 and seems still getting this problem, as described in #236 (comment). |
Check your build size and make sure useServerlessTraceTarget is enabled. |
This has happened to me again recently, while upgrading some packages to their latest version. It was only happening in my During this process I got hit by the following error in my CI/CD coming from NextJS:
In my case I was using I am not sure if that is the actual root cause of considering other contributions from this tread. Anyway hope it helps! |
I am using typescript in my project and just got this error. Adding this to build.js like was called out above made it work:
Any reason this wouldn't be appropriate to turn into a permanent fix? |
@Enalmada I think that can be a fix but just wanted to make sure with @danielcondemarin it won't break other cases? Edit: I think that is not quite the right fix, let me take a closer look. Edit2: I believe I have fixed this for TypeScript projects, if still encountering issues for other types of projects, please open a new issue with details of the error messages. Thanks! |
I am suffering from this problem as well. I am using mikro-orm in my project, which uses TypeScript. If I build outside of the serverless environment, or on vercel, everything works as expected. If I try and build locally using the This is my config:
EDIT: I tested on a vanilla |
@jonahallibone thanks for that. Can you please try to use the latest alpha version which has the fix for TypeScript and see if that works. If not, you can also try to build this component from source and try adding some logging statements here to figure out why it is failing, e.g you can print out But for other project structures, I'm thinking we should just modify the |
@dphang with the latest alpha I still get
|
@jonahallibone Yeah, probably the error message is not helpful as it's from fse.copy() failing due to source and destination being the same. I added a PR which should at least prevent those copies from happening - and let the build proceed, but not sure if it will be a correct build, but at least will be a better developer experience. |
@dphang I am more than happy to build from source and test it, but tbh I am a little unsure how to do that locally. If you have any pointers, I'd love to help test. |
@jonahallibone thanks. You can follow https://github.com/serverless-nextjs/serverless-next.js/blob/master/CONTRIBUTING.md to setup. Basically it involves:
You could also pull the #760 branch and see if it helps. It at least should not fail, though I'm not completely if it will copy all sources correctly for different project structures. I will probably just merge it in a bit as it is safe and still better DX than before. |
Cool, thanks for the feedback. No one else should be getting this exact issue anymore with the latest alpha version, but if you have related issues (e.g assets not copied to right place), please let us know by filing a new issue. Thanks! |
This is most likely some misconfiguration on my part but I can't figure out what exactly is wrong. I reported this issue with a comment on #405 but I believe it's more appropriate to create a bug report. Let me know if this isn't the right way :)
Describe the bug
When running
serverless
with the InputsuseServerlessTraceTarget: true
the build fails with the following output:To Reproduce
With the following configuration:
package.json
:serverless.yml
:next.config.js
:Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: